2100000000000-Indexes.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. }
  28. async down(db) {
  29. await db.query(`DROP INDEX "events_video"`)
  30. await db.query(`DROP INDEX "events_comment"`)
  31. await db.query(`DROP INDEX "events_nft_owner_member"`)
  32. await db.query(`DROP INDEX "events_nft_owner_channel"`)
  33. await db.query(`DROP INDEX "events_auction"`)
  34. await db.query(`DROP INDEX "events_type"`)
  35. await db.query(`DROP INDEX "events_nft"`)
  36. await db.query(`DROP INDEX "events_bid"`)
  37. await db.query(`DROP INDEX "events_member"`)
  38. await db.query(`DROP INDEX "events_winning_bid"`)
  39. await db.query(`DROP INDEX "events_previous_nft_owner_member"`)
  40. await db.query(`DROP INDEX "events_previous_nft_owner_channel"`)
  41. await db.query(`DROP INDEX "events_buyer"`)
  42. }
  43. }