2100000000000-Indexes.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. module.exports = class Indexes2000000000000 {
  2. name = 'Indexes2000000000000'
  3. async up(db) {
  4. await db.query(`CREATE INDEX "events_video" ON "processor"."event" USING BTREE (("data"->>'video'));`)
  5. await db.query(`CREATE INDEX "events_comment" ON "processor"."event" USING BTREE (("data"->>'comment'));`)
  6. await db.query(
  7. `CREATE INDEX "events_nft_owner_member" ON "processor"."event" USING BTREE (("data"->'nftOwner'->>'member'));`
  8. )
  9. await db.query(
  10. `CREATE INDEX "events_nft_owner_channel" ON "processor"."event" USING BTREE (("data"->'nftOwner'->>'channel'));`
  11. )
  12. await db.query(`CREATE INDEX "events_auction" ON "processor"."event" USING BTREE (("data"->>'auction'));`)
  13. await db.query(`CREATE INDEX "events_type" ON "processor"."event" USING BTREE (("data"->>'isTypeOf'));`)
  14. await db.query(`CREATE INDEX "events_nft" ON "processor"."event" USING BTREE (("data"->>'nft'));`)
  15. await db.query(`CREATE INDEX "events_bid" ON "processor"."event" USING BTREE (("data"->>'bid'));`)
  16. await db.query(`CREATE INDEX "events_member" ON "processor"."event" USING BTREE (("data"->>'member'));`)
  17. await db.query(
  18. `CREATE INDEX "events_winning_bid" ON "processor"."event" USING BTREE (("data"->>'winningBid'));`
  19. )
  20. await db.query(
  21. `CREATE INDEX "events_previous_nft_owner_member" ON "processor"."event" USING BTREE (("data"->'previousNftOwner'->>'member'));`
  22. )
  23. await db.query(
  24. `CREATE INDEX "events_previous_nft_owner_channel" ON "processor"."event" USING BTREE (("data"->'previousNftOwner'->>'channel'));`
  25. )
  26. await db.query(`CREATE INDEX "events_buyer" ON "processor"."event" USING BTREE (("data"->>'buyer'));`)
  27. await db.query(`CREATE INDEX "auction_type" ON "processor"."auction" USING BTREE (("auction_type"->>'isTypeOf'));`)
  28. await db.query(`CREATE INDEX "member_metadata_avatar" ON "member_metadata" USING BTREE (("avatar"->>'avatarObject'));`)
  29. await db.query(`CREATE INDEX "owned_nft_auction" ON "processor"."owned_nft" USING BTREE (("transactional_status"->>'auction'));`)
  30. }
  31. async down(db) {
  32. await db.query(`DROP INDEX "events_video"`)
  33. await db.query(`DROP INDEX "events_comment"`)
  34. await db.query(`DROP INDEX "events_nft_owner_member"`)
  35. await db.query(`DROP INDEX "events_nft_owner_channel"`)
  36. await db.query(`DROP INDEX "events_auction"`)
  37. await db.query(`DROP INDEX "events_type"`)
  38. await db.query(`DROP INDEX "events_nft"`)
  39. await db.query(`DROP INDEX "events_bid"`)
  40. await db.query(`DROP INDEX "events_member"`)
  41. await db.query(`DROP INDEX "events_winning_bid"`)
  42. await db.query(`DROP INDEX "events_previous_nft_owner_member"`)
  43. await db.query(`DROP INDEX "events_previous_nft_owner_channel"`)
  44. await db.query(`DROP INDEX "events_buyer"`)
  45. }
  46. }