feat: Migrate gift collection from slug to ID#225
Merged
Conversation
- Update GiftCollection model: replace slug PK with integer id, add options (JSONB) and blockchain_address fields - Update GiftUnique model: replace collection_slug FK with collection_id FK - Update TelegramChatGiftCollection model: replace collection_slug FK with collection_id FK - Create Alembic migration with schema changes, data migration from JSON mapping, and cleanup - Refactor DTOs, services, actions, and API routes to use integer IDs - Update chat eligibility logic (find_relevant_gift_items) to use collection_id - Temporarily disable gift indexer tasks and comment out slug-dependent indexer methods
49ad88f to
49387de
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrate Gift Collection Indexing from Slug to Telegram Internal ID
Description
Migrate Gift Collection and Gift Unique indexing from slug-based primary keys to integer IDs (Telegram gift IDs). This is Phase 0 of the gift indexer rewrite — the schema and codebase are updated to support integer-based lookups while the full indexer rewrite is planned separately.
Checklist
Before submitting your pull request, please ensure the following:
Changes
GiftCollection.slug(VARCHAR PK) withGiftCollection.id(BigInteger PK). Addedoptions(JSONB) andblockchain_addressfields. Replacedcollection_slugFK withcollection_idFK in GiftUniqueGiftCollectionDTO,GiftUniqueDTO,GiftFilterDTO,GiftCollectionService, andGiftUniqueServiceto use integer IDs.GiftUniqueAction,TelegramChatGiftCollectionAction, and API endpoint from/gifts/{collection_slug}to/gifts/{collection_id}.find_relevant_gift_itemsto comparecollection_idinstead ofcollection_slug.How Has This Been Tested?
make test.gift_uniqueitems andtelegram_chat_gift_collectionrules usingcollection_slug) and validating all three tables were correctly mapped to integer IDs after running the migration.alembic upgradeandalembic downgradework correctly.Screenshots (if applicable)
N/A — backend-only changes.
Additional Notes
Thank you for contributing! 🎉