Database Migration

This guide will help you navigate schema changes and table updates from Lens v2 to v3.


The Lens V3 schema has been changed on reflection from all our learning on the past protocols. If you were using Public Big Query this will show you want the names of the tables where and what they are now. This guide will only highlight V2 tables any new ones you can look on the Public Big Query. Note we have not integrated actions and rules yet in the API and indexer so they are missing from here for now.

Key differences

  • You will see on the schema a more less strict primary key and foreign key structure, with Lens V3 we optimised for speed and indexing blockchain data can be a lot faster if you process things concurrently.

  • Database size has been optimised so we are storing binary format for all the hex values which makes each value 2x less in size alongside makes queries faster.

Moved Tables

Note the new tables may also have different columns.

  • app_stats.profile > app.account_post_summary

  • app_stats.profile_reacted > app.account_reacted_summary

  • app_stats.profile_reaction > app.account_reaction_summary

  • app_stats.publication > app.post_summary

  • app_stats.publication_reaction > app.post_reaction_summary

  • app_stats.publication_tag > app.post_tag_summary

  • curation.profile > curation.account

  • curation.profile_tag > curation.account_tag

  • enabled.currency > currencies.record

  • global_stats.profile > account.post_summary

  • global_stats.profile_follower > account.follower_summary

  • global_stats.profile_reacted > account.reacted_summary

  • global_stats.profile_reaction > account.reaction_summary

  • global_stats.publication > post.summary

  • global_stats.publication_reaction > post.reaction_summary

  • global_stats.publication_tag > post.tag_summary

  • machine_learning.for_you_global_feed > ml.for_you_global_timeline

  • machine_learning.popularity_trending_feed > ml.popularity_trending_timeline

  • machine_learning.profile_boosting > ml.account_boosting

  • machine_learning.quality_profiles > ml.account_score

  • machine_learning.reply_ranking > ml.reply_ranking

  • namespace.handle > username.record

  • namespace.record > username.namespace_record

  • namespace.handle_link > account.username_assigned

  • notification.record > account.notification

  • personalisation.bookmarked_publication > account.bookmarked_post

  • personalisation.not_interested_publication > account.not_interested_post

  • personalisation.wtf_recommendation_dismissed > ml.who_to_follow_dismissed

  • personalisation.wtf_recommendation_dismissed > ml.who_to_follow_dismissed

  • profile.follow_module > account.follow_rule

  • profile.last_logged_in > account.last_logged_in

  • profile.follower > account.follower

  • profile.ownership_history > account.record_owner_history

  • profile.peer_to_peer_recommendation > account.peer_to_peer_recommendation

  • publication.mention > post.mention

  • profile.record > account.record

  • profile.reported > account.reported

  • publication.hashtag > post.hashtag

  • publication.open_action_module > post.action

  • publication.open_action_module_acted_record > account.acted

  • publication.metadata > post.metadata

  • publication.open_action_module_collect_nft > post.action column collect_nft_address

  • publication.open_action_module_multirecipient > post.action column recipients

  • publication.reaction > post.reaction

  • publication.reaction_type > post.reaction_type

  • publication.record > post.record

  • publication.reported > post.reported

  • publication.tag > post.tag

  • profile.blocked > account.blocked

  • profile.manager > account.manager

  • profile.metadata > account.metadata

  • profile.metadata_failed > metadata.failed

  • profile.metadata_pending > metadata.pending

  • publication.failed > metadata.failed

  • publication.pending > metadata.pending

  • publication.type > post.type

  • enabled.follow_module > Not completed yet

  • enable.reference_module > Not completed yet

  • enabled.open_action_module> Not completed yet

  • profile.follow_module_record > Not completed yet

  • publication.reference_module > Not completed yet

  • publication.referrer > Not completed yet

  • publication.open_action_module_acted_record_referrer > Not completed yet

Deprecated Tables

These tables have been killed

  • app.onboarding_access

  • app.onboarding_handle

  • app.onboarding_profile

  • app.profile_revenue

  • app.profile_revenue

  • app.profile_revenue_record

  • app.public_key

  • app.publication_revenue

  • app.publication_revenue_open_action

  • app.publication_revenue_record

  • app_stats.hashtag

  • app_stats.mention

  • app_stats.mention_handle

  • app_stats.profile_open_action

  • app_stats.publication_content_warning

  • app_stats.publication_locale

  • app_stats.publication_main_content_focus

  • app_stats.publication_open_action

  • app_stats.publication_tagged

  • curation.profile_interest

  • enabled.currency_history

  • enabled.follow_module_history

  • enabled.open_action_module_history

  • enable.profile_creator

  • enable.profile_creator_history

  • enable.reference_module_history

  • ens

  • fiat

  • global_stats.hashtag

  • global_stats.mention

  • global_stats.mention_handle

  • global_stats.profile_manager

  • global_stats.profile_open_action

  • global_stats.publication_content_warning

  • global_stats.publication_locale

  • global_stats.publication_main_content_focus

  • global_stats.publication_open_action

  • global_stats.publication_tagged

  • machine_learning.profile_boosting_history

  • machine_learning.proof_of_human

  • media.livepeer_mapping

  • momoka.*

  • namespace.handle_guardian

  • namespace.handle_guardian_history

  • namespace.handle_history

  • namespace.handle_link_history

  • nft.*

  • notification.type

  • personalisation.bookmarked_publication_history

  • personalisation.not_interested_publication_history

  • poap.*

  • profile.action_history

  • profile.blocked_history

  • profile.default

  • profile.follow_module_history

  • profile.follow_nft

  • profile.follower_history

  • profile.gallery

  • profile.gallery_history

  • profile.guardian

  • profile.guardian_history

  • profile.interest

  • profile.interest_history

  • profile.manager_active_config_number

  • profile.manager_active_config_number_history

  • profile.manager_all_config

  • profile.manager_all_config_history

  • profile.metadata_history

  • profile.nft_picture

  • profile.nft_picture_history

  • profile.revenue

  • profile.revenue_record

  • profile.unfollow_audit_log

  • proof_of_humanity.*

  • protocol.*

  • publication.hashtag_history

  • publication.id

  • publication.mention_history

  • publication.metadata_history

  • publication.open_action_module_collect_nft_ownership

  • publication.open_action_module_collect_nft_ownership_history

  • publication.open_action_module_history

  • publication.reaction_history

  • publication.reference_module_history

  • publication.revenue

  • publication.revenue_open_action

  • publication.revenue_record

  • publication.secured_metadata_id_executed

  • publication.tag_history

  • sybil_dot_org.*

  • worldcoin.*