diff --git a/db/migrations/1686758014971-Data.js b/db/migrations/1693417726367-Data.js similarity index 99% rename from db/migrations/1686758014971-Data.js rename to db/migrations/1693417726367-Data.js index 84ae3714d..ef46218cf 100644 --- a/db/migrations/1686758014971-Data.js +++ b/db/migrations/1693417726367-Data.js @@ -1,5 +1,5 @@ -module.exports = class Data1686758014971 { - name = 'Data1686758014971' +module.exports = class Data1693417726367 { + name = 'Data1693417726367' async up(db) { await db.query(`CREATE TABLE "bid" ("id" character varying NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "auction_id" character varying, "nft_id" character varying, "bidder_id" character varying, "amount" numeric NOT NULL, "is_canceled" boolean NOT NULL, "created_in_block" integer NOT NULL, "index_in_block" integer NOT NULL, "previous_top_bid_id" character varying, CONSTRAINT "PK_ed405dda320051aca2dcb1a50bb" PRIMARY KEY ("id"))`) @@ -75,33 +75,17 @@ module.exports = class Data1686758014971 { await db.query(`CREATE INDEX "IDX_2db879ed42e3308fe65e679672" ON "video" ("media_id") `) await db.query(`CREATE INDEX "IDX_54f88a7decf7d22fd9bd9fa439" ON "video" ("pinned_comment_id") `) await db.query(`CREATE INDEX "IDX_6c49ad08c44d36d11f77c426e4" ON "video" ("entry_app_id") `) + await db.query(`CREATE INDEX "IDX_f33816960d690ac836f5d5c28a" ON "video" ("video_relevance") `) await db.query(`CREATE TABLE "owned_nft" ("id" character varying NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "video_id" character varying NOT NULL, "owner" jsonb NOT NULL, "transactional_status" jsonb, "creator_royalty" numeric, "last_sale_price" numeric, "last_sale_date" TIMESTAMP WITH TIME ZONE, "is_featured" boolean NOT NULL, CONSTRAINT "OwnedNft_video" UNIQUE ("video_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_466896e39b9ec953f4f2545622" UNIQUE ("video_id"), CONSTRAINT "PK_5e0c289b350e863668fff44bb56" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_466896e39b9ec953f4f2545622" ON "owned_nft" ("video_id") `) - await db.query(`CREATE TABLE "storage_bucket_operator_metadata" ("id" character varying NOT NULL, "storage_bucket_id" character varying NOT NULL, "node_endpoint" text, "node_location" jsonb, "extra" text, CONSTRAINT "StorageBucketOperatorMetadata_storageBucket" UNIQUE ("storage_bucket_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_7beffc9530b3f307bc1169cb52" UNIQUE ("storage_bucket_id"), CONSTRAINT "PK_9846a397400ae1a39b21fbd02d4" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_7beffc9530b3f307bc1169cb52" ON "storage_bucket_operator_metadata" ("storage_bucket_id") `) - await db.query(`CREATE TABLE "distribution_bucket_family_metadata" ("id" character varying NOT NULL, "family_id" character varying NOT NULL, "region" text, "description" text, "areas" jsonb, "latency_test_targets" text array, CONSTRAINT "DistributionBucketFamilyMetadata_family" UNIQUE ("family_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_dd93ca0ea24f3e7a02f11c4c14" UNIQUE ("family_id"), CONSTRAINT "PK_df7a270835bb313d3ef17bdee2f" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_dd93ca0ea24f3e7a02f11c4c14" ON "distribution_bucket_family_metadata" ("family_id") `) - await db.query(`CREATE INDEX "IDX_5510d3b244a63d6ec702faa426" ON "distribution_bucket_family_metadata" ("region") `) - await db.query(`CREATE TABLE "distribution_bucket_operator_metadata" ("id" character varying NOT NULL, "distirbution_bucket_operator_id" character varying NOT NULL, "node_endpoint" text, "node_location" jsonb, "extra" text, CONSTRAINT "DistributionBucketOperatorMetadata_distirbutionBucketOperator" UNIQUE ("distirbution_bucket_operator_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_69ec9bdc975b95f7dff94a7106" UNIQUE ("distirbution_bucket_operator_id"), CONSTRAINT "PK_9bbecaa12f30e3826922688274f" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_69ec9bdc975b95f7dff94a7106" ON "distribution_bucket_operator_metadata" ("distirbution_bucket_operator_id") `) - await db.query(`CREATE TABLE "event" ("id" character varying NOT NULL, "in_block" integer NOT NULL, "in_extrinsic" text, "index_in_block" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "data" jsonb NOT NULL, CONSTRAINT "PK_30c2f3bbaf6d34a55f8ae6e4614" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_8f3f220c4e717207d841d4e6d4" ON "event" ("in_extrinsic") `) - await db.query(`CREATE TABLE "notification" ("id" character varying NOT NULL, "member_id" character varying, "event_id" character varying, CONSTRAINT "PK_705b6c7cdf9b2c2ff7ac7872cb7" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_ac8de39626657d3c0e909d9d82" ON "notification" ("member_id") `) - await db.query(`CREATE INDEX "IDX_122be1f0696e0255acf95f9e33" ON "notification" ("event_id") `) - await db.query(`CREATE TABLE "nft_history_entry" ("id" character varying NOT NULL, "nft_id" character varying, "event_id" character varying, CONSTRAINT "PK_9018e80b335a965a54959c4c6e2" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_57f51d35ecab042478fe2e31c1" ON "nft_history_entry" ("nft_id") `) - await db.query(`CREATE INDEX "IDX_d1a28b178f5d028d048d40ce20" ON "nft_history_entry" ("event_id") `) - await db.query(`CREATE TABLE "nft_activity" ("id" character varying NOT NULL, "member_id" character varying, "event_id" character varying, CONSTRAINT "PK_1553b1bbf8000039875a6e31536" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_18a65713a9fd0715c7a980f5d5" ON "nft_activity" ("member_id") `) - await db.query(`CREATE INDEX "IDX_94d325a753f2c08fdd416eb095" ON "nft_activity" ("event_id") `) - await db.query(`CREATE TABLE "member_metadata" ("id" character varying NOT NULL, "name" text, "avatar" jsonb, "about" text, "member_id" character varying NOT NULL, CONSTRAINT "MemberMetadata_member" UNIQUE ("member_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_e7e4d350f82ae2383894f465ed" UNIQUE ("member_id"), CONSTRAINT "PK_d3fcc374696465f3c0ac3ba8708" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_e7e4d350f82ae2383894f465ed" ON "member_metadata" ("member_id") `) await db.query(`CREATE TABLE "curator_group" ("id" character varying NOT NULL, "is_active" boolean NOT NULL, CONSTRAINT "PK_0b4c0ab279d72bcbf4e16b65ff1" PRIMARY KEY ("id"))`) await db.query(`CREATE TABLE "curator" ("id" character varying NOT NULL, CONSTRAINT "PK_5791051a62d2c2dfc593d38ab57" PRIMARY KEY ("id"))`) await db.query(`CREATE TABLE "channel_follow" ("id" character varying NOT NULL, "user_id" character varying, "channel_id" text NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_9410df2b9a316af3f0d216f9487" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_822778b4b1ea8e3b60b127cb8b" ON "channel_follow" ("user_id") `) await db.query(`CREATE INDEX "IDX_9bc0651dda94437ec18764a260" ON "channel_follow" ("channel_id") `) + await db.query(`CREATE TABLE "video_view_event" ("id" character varying NOT NULL, "video_id" text NOT NULL, "user_id" character varying, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_2efd85597a6a7a704fc4d0f7701" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_2e29fba63e12a2b1818e0782d7" ON "video_view_event" ("video_id") `) + await db.query(`CREATE INDEX "IDX_31e1e798ec387ad905cf98d33b" ON "video_view_event" ("user_id") `) await db.query(`CREATE TABLE "report" ("id" character varying NOT NULL, "user_id" character varying, "channel_id" text, "video_id" text, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "rationale" text NOT NULL, CONSTRAINT "PK_99e4d0bea58cba73c57f935a546" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_c6686efa4cd49fa9a429f01bac" ON "report" ("user_id") `) await db.query(`CREATE INDEX "IDX_893057921f4b5cc37a0ef36684" ON "report" ("channel_id") `) @@ -110,16 +94,6 @@ module.exports = class Data1686758014971 { await db.query(`CREATE INDEX "IDX_519be2a41216c278c35f254dcb" ON "nft_featuring_request" ("user_id") `) await db.query(`CREATE INDEX "IDX_76d87e26cce72ac2e7ffa28dfb" ON "nft_featuring_request" ("nft_id") `) await db.query(`CREATE TABLE "user" ("id" character varying NOT NULL, "is_root" boolean NOT NULL, CONSTRAINT "PK_cace4a159ff9f2512dd42373760" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "video_view_event" ("id" character varying NOT NULL, "video_id" text NOT NULL, "user_id" character varying, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_2efd85597a6a7a704fc4d0f7701" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_2e29fba63e12a2b1818e0782d7" ON "video_view_event" ("video_id") `) - await db.query(`CREATE INDEX "IDX_31e1e798ec387ad905cf98d33b" ON "video_view_event" ("user_id") `) - await db.query(`CREATE TABLE "gateway_config" ("id" character varying NOT NULL, "value" text NOT NULL, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_db1fa5a857fb6292eee4c493e6f" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "video_hero" ("id" character varying NOT NULL, "video_id" character varying, "hero_title" text NOT NULL, "hero_video_cut_url" text NOT NULL, "hero_poster_url" text NOT NULL, "activated_at" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_f3b63979879773378afac0b9495" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_9feac5d9713a9f07e32eb8ba7a" ON "video_hero" ("video_id") `) - await db.query(`CREATE TABLE "video_media_encoding" ("id" character varying NOT NULL, "codec_name" text, "container" text, "mime_media_type" text, CONSTRAINT "PK_52e25874f8d8a381e154d1125e0" PRIMARY KEY ("id"))`) - await db.query(`CREATE TABLE "video_media_metadata" ("id" character varying NOT NULL, "encoding_id" character varying, "pixel_width" integer, "pixel_height" integer, "size" numeric, "video_id" character varying NOT NULL, "created_in_block" integer NOT NULL, CONSTRAINT "VideoMediaMetadata_video" UNIQUE ("video_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_4dc101240e8e1536b770aee202" UNIQUE ("video_id"), CONSTRAINT "PK_86a13815734e589cd86d0465e2d" PRIMARY KEY ("id"))`) - await db.query(`CREATE INDEX "IDX_5944dc5896cb16bd395414a0ce" ON "video_media_metadata" ("encoding_id") `) - await db.query(`CREATE INDEX "IDX_4dc101240e8e1536b770aee202" ON "video_media_metadata" ("video_id") `) await db.query(`CREATE TABLE "account" ("id" character varying NOT NULL, "user_id" character varying NOT NULL, "email" text NOT NULL, "is_email_confirmed" boolean NOT NULL, "is_blocked" boolean NOT NULL, "registered_at" TIMESTAMP WITH TIME ZONE NOT NULL, "membership_id" character varying NOT NULL, "joystream_account" text NOT NULL, CONSTRAINT "Account_joystreamAccount" UNIQUE ("joystream_account") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "Account_membership" UNIQUE ("membership_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "Account_email" UNIQUE ("email") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "Account_user" UNIQUE ("user_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_efef1e5fdbe318a379c06678c5" UNIQUE ("user_id"), CONSTRAINT "REL_601b93655bcbe73cb58d8c80cd" UNIQUE ("membership_id"), CONSTRAINT "PK_54115ee388cdb6d86bb4bf5b2ea" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_efef1e5fdbe318a379c06678c5" ON "account" ("user_id") `) await db.query(`CREATE INDEX "IDX_4c8f96ccf523e9a3faefd5bdd4" ON "account" ("email") `) @@ -135,6 +109,33 @@ module.exports = class Data1686758014971 { await db.query(`CREATE INDEX "IDX_3612880efd8926a17eba5ab0e1" ON "session_encryption_artifacts" ("session_id") `) await db.query(`CREATE TABLE "token" ("id" character varying NOT NULL, "type" character varying(18) NOT NULL, "issued_at" TIMESTAMP WITH TIME ZONE NOT NULL, "expiry" TIMESTAMP WITH TIME ZONE NOT NULL, "issued_for_id" character varying, CONSTRAINT "PK_82fae97f905930df5d62a702fc9" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_a6fe18c105f85a63d761ccb078" ON "token" ("issued_for_id") `) + await db.query(`CREATE TABLE "event" ("id" character varying NOT NULL, "in_block" integer NOT NULL, "in_extrinsic" text, "index_in_block" integer NOT NULL, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "data" jsonb NOT NULL, CONSTRAINT "PK_30c2f3bbaf6d34a55f8ae6e4614" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_8f3f220c4e717207d841d4e6d4" ON "event" ("in_extrinsic") `) + await db.query(`CREATE TABLE "notification" ("id" character varying NOT NULL, "member_id" character varying, "event_id" character varying, CONSTRAINT "PK_705b6c7cdf9b2c2ff7ac7872cb7" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_ac8de39626657d3c0e909d9d82" ON "notification" ("member_id") `) + await db.query(`CREATE INDEX "IDX_122be1f0696e0255acf95f9e33" ON "notification" ("event_id") `) + await db.query(`CREATE TABLE "nft_history_entry" ("id" character varying NOT NULL, "nft_id" character varying, "event_id" character varying, CONSTRAINT "PK_9018e80b335a965a54959c4c6e2" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_57f51d35ecab042478fe2e31c1" ON "nft_history_entry" ("nft_id") `) + await db.query(`CREATE INDEX "IDX_d1a28b178f5d028d048d40ce20" ON "nft_history_entry" ("event_id") `) + await db.query(`CREATE TABLE "nft_activity" ("id" character varying NOT NULL, "member_id" character varying, "event_id" character varying, CONSTRAINT "PK_1553b1bbf8000039875a6e31536" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_18a65713a9fd0715c7a980f5d5" ON "nft_activity" ("member_id") `) + await db.query(`CREATE INDEX "IDX_94d325a753f2c08fdd416eb095" ON "nft_activity" ("event_id") `) + await db.query(`CREATE TABLE "gateway_config" ("id" character varying NOT NULL, "value" text NOT NULL, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_db1fa5a857fb6292eee4c493e6f" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "member_metadata" ("id" character varying NOT NULL, "name" text, "avatar" jsonb, "about" text, "member_id" character varying NOT NULL, CONSTRAINT "MemberMetadata_member" UNIQUE ("member_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_e7e4d350f82ae2383894f465ed" UNIQUE ("member_id"), CONSTRAINT "PK_d3fcc374696465f3c0ac3ba8708" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_e7e4d350f82ae2383894f465ed" ON "member_metadata" ("member_id") `) + await db.query(`CREATE TABLE "storage_bucket_operator_metadata" ("id" character varying NOT NULL, "storage_bucket_id" character varying NOT NULL, "node_endpoint" text, "node_location" jsonb, "extra" text, CONSTRAINT "StorageBucketOperatorMetadata_storageBucket" UNIQUE ("storage_bucket_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_7beffc9530b3f307bc1169cb52" UNIQUE ("storage_bucket_id"), CONSTRAINT "PK_9846a397400ae1a39b21fbd02d4" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_7beffc9530b3f307bc1169cb52" ON "storage_bucket_operator_metadata" ("storage_bucket_id") `) + await db.query(`CREATE TABLE "distribution_bucket_family_metadata" ("id" character varying NOT NULL, "family_id" character varying NOT NULL, "region" text, "description" text, "areas" jsonb, "latency_test_targets" text array, CONSTRAINT "DistributionBucketFamilyMetadata_family" UNIQUE ("family_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_dd93ca0ea24f3e7a02f11c4c14" UNIQUE ("family_id"), CONSTRAINT "PK_df7a270835bb313d3ef17bdee2f" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_dd93ca0ea24f3e7a02f11c4c14" ON "distribution_bucket_family_metadata" ("family_id") `) + await db.query(`CREATE INDEX "IDX_5510d3b244a63d6ec702faa426" ON "distribution_bucket_family_metadata" ("region") `) + await db.query(`CREATE TABLE "distribution_bucket_operator_metadata" ("id" character varying NOT NULL, "distirbution_bucket_operator_id" character varying NOT NULL, "node_endpoint" text, "node_location" jsonb, "extra" text, CONSTRAINT "DistributionBucketOperatorMetadata_distirbutionBucketOperator" UNIQUE ("distirbution_bucket_operator_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_69ec9bdc975b95f7dff94a7106" UNIQUE ("distirbution_bucket_operator_id"), CONSTRAINT "PK_9bbecaa12f30e3826922688274f" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_69ec9bdc975b95f7dff94a7106" ON "distribution_bucket_operator_metadata" ("distirbution_bucket_operator_id") `) + await db.query(`CREATE TABLE "video_hero" ("id" character varying NOT NULL, "video_id" character varying, "hero_title" text NOT NULL, "hero_video_cut_url" text NOT NULL, "hero_poster_url" text NOT NULL, "activated_at" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_f3b63979879773378afac0b9495" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_9feac5d9713a9f07e32eb8ba7a" ON "video_hero" ("video_id") `) + await db.query(`CREATE TABLE "video_media_encoding" ("id" character varying NOT NULL, "codec_name" text, "container" text, "mime_media_type" text, CONSTRAINT "PK_52e25874f8d8a381e154d1125e0" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "video_media_metadata" ("id" character varying NOT NULL, "encoding_id" character varying, "pixel_width" integer, "pixel_height" integer, "size" numeric, "video_id" character varying NOT NULL, "created_in_block" integer NOT NULL, CONSTRAINT "VideoMediaMetadata_video" UNIQUE ("video_id") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "REL_4dc101240e8e1536b770aee202" UNIQUE ("video_id"), CONSTRAINT "PK_86a13815734e589cd86d0465e2d" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5944dc5896cb16bd395414a0ce" ON "video_media_metadata" ("encoding_id") `) + await db.query(`CREATE INDEX "IDX_4dc101240e8e1536b770aee202" ON "video_media_metadata" ("video_id") `) await db.query(`CREATE TABLE "next_entity_id" ("entity_name" character varying NOT NULL, "next_id" bigint NOT NULL, CONSTRAINT "PK_09a3b40db622a65096e7344d7ae" PRIMARY KEY ("entity_name"))`) await db.query(`ALTER TABLE "bid" ADD CONSTRAINT "FK_9e594e5a61c0f3cb25679f6ba8d" FOREIGN KEY ("auction_id") REFERENCES "auction"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) await db.query(`ALTER TABLE "bid" ADD CONSTRAINT "FK_3caf2d6b31d2fe45a2b85b81912" FOREIGN KEY ("nft_id") REFERENCES "owned_nft"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) @@ -180,23 +181,10 @@ module.exports = class Data1686758014971 { await db.query(`ALTER TABLE "video" ADD CONSTRAINT "FK_54f88a7decf7d22fd9bd9fa439a" FOREIGN KEY ("pinned_comment_id") REFERENCES "comment"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) await db.query(`ALTER TABLE "video" ADD CONSTRAINT "FK_6c49ad08c44d36d11f77c426e43" FOREIGN KEY ("entry_app_id") REFERENCES "app"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) await db.query(`ALTER TABLE "owned_nft" ADD CONSTRAINT "FK_466896e39b9ec953f4f2545622d" FOREIGN KEY ("video_id") REFERENCES "video"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "storage_bucket_operator_metadata" ADD CONSTRAINT "FK_7beffc9530b3f307bc1169cb524" FOREIGN KEY ("storage_bucket_id") REFERENCES "storage_bucket"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "distribution_bucket_family_metadata" ADD CONSTRAINT "FK_dd93ca0ea24f3e7a02f11c4c149" FOREIGN KEY ("family_id") REFERENCES "distribution_bucket_family"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "distribution_bucket_operator_metadata" ADD CONSTRAINT "FK_69ec9bdc975b95f7dff94a71069" FOREIGN KEY ("distirbution_bucket_operator_id") REFERENCES "distribution_bucket_operator"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_ac8de39626657d3c0e909d9d82f" FOREIGN KEY ("member_id") REFERENCES "membership"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_122be1f0696e0255acf95f9e336" FOREIGN KEY ("event_id") REFERENCES "event"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "nft_history_entry" ADD CONSTRAINT "FK_57f51d35ecab042478fe2e31c19" FOREIGN KEY ("nft_id") REFERENCES "owned_nft"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "nft_history_entry" ADD CONSTRAINT "FK_d1a28b178f5d028d048d40ce208" FOREIGN KEY ("event_id") REFERENCES "event"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "nft_activity" ADD CONSTRAINT "FK_18a65713a9fd0715c7a980f5d54" FOREIGN KEY ("member_id") REFERENCES "membership"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "nft_activity" ADD CONSTRAINT "FK_94d325a753f2c08fdd416eb095f" FOREIGN KEY ("event_id") REFERENCES "event"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "member_metadata" ADD CONSTRAINT "FK_e7e4d350f82ae2383894f465ede" FOREIGN KEY ("member_id") REFERENCES "membership"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) await db.query(`ALTER TABLE "channel_follow" ADD CONSTRAINT "FK_822778b4b1ea8e3b60b127cb8b1" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "video_view_event" ADD CONSTRAINT "FK_31e1e798ec387ad905cf98d33b0" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) await db.query(`ALTER TABLE "report" ADD CONSTRAINT "FK_c6686efa4cd49fa9a429f01bac8" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) await db.query(`ALTER TABLE "nft_featuring_request" ADD CONSTRAINT "FK_519be2a41216c278c35f254dcba" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "video_view_event" ADD CONSTRAINT "FK_31e1e798ec387ad905cf98d33b0" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "video_hero" ADD CONSTRAINT "FK_9feac5d9713a9f07e32eb8ba7a1" FOREIGN KEY ("video_id") REFERENCES "video"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "video_media_metadata" ADD CONSTRAINT "FK_5944dc5896cb16bd395414a0ce0" FOREIGN KEY ("encoding_id") REFERENCES "video_media_encoding"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) - await db.query(`ALTER TABLE "video_media_metadata" ADD CONSTRAINT "FK_4dc101240e8e1536b770aee202a" FOREIGN KEY ("video_id") REFERENCES "video"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) await db.query(`ALTER TABLE "account" ADD CONSTRAINT "FK_efef1e5fdbe318a379c06678c51" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) await db.query(`ALTER TABLE "account" ADD CONSTRAINT "FK_601b93655bcbe73cb58d8c80cd3" FOREIGN KEY ("membership_id") REFERENCES "membership"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) await db.query(`ALTER TABLE "encryption_artifacts" ADD CONSTRAINT "FK_ec8f68a544aadc4fbdadefe4a0a" FOREIGN KEY ("account_id") REFERENCES "account"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) @@ -204,6 +192,19 @@ module.exports = class Data1686758014971 { await db.query(`ALTER TABLE "session" ADD CONSTRAINT "FK_fae5a6b4a57f098e9af8520d499" FOREIGN KEY ("account_id") REFERENCES "account"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) await db.query(`ALTER TABLE "session_encryption_artifacts" ADD CONSTRAINT "FK_3612880efd8926a17eba5ab0e1a" FOREIGN KEY ("session_id") REFERENCES "session"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) await db.query(`ALTER TABLE "token" ADD CONSTRAINT "FK_a6fe18c105f85a63d761ccb0780" FOREIGN KEY ("issued_for_id") REFERENCES "account"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_ac8de39626657d3c0e909d9d82f" FOREIGN KEY ("member_id") REFERENCES "membership"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "notification" ADD CONSTRAINT "FK_122be1f0696e0255acf95f9e336" FOREIGN KEY ("event_id") REFERENCES "event"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "nft_history_entry" ADD CONSTRAINT "FK_57f51d35ecab042478fe2e31c19" FOREIGN KEY ("nft_id") REFERENCES "owned_nft"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "nft_history_entry" ADD CONSTRAINT "FK_d1a28b178f5d028d048d40ce208" FOREIGN KEY ("event_id") REFERENCES "event"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "nft_activity" ADD CONSTRAINT "FK_18a65713a9fd0715c7a980f5d54" FOREIGN KEY ("member_id") REFERENCES "membership"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "nft_activity" ADD CONSTRAINT "FK_94d325a753f2c08fdd416eb095f" FOREIGN KEY ("event_id") REFERENCES "event"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "member_metadata" ADD CONSTRAINT "FK_e7e4d350f82ae2383894f465ede" FOREIGN KEY ("member_id") REFERENCES "membership"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "storage_bucket_operator_metadata" ADD CONSTRAINT "FK_7beffc9530b3f307bc1169cb524" FOREIGN KEY ("storage_bucket_id") REFERENCES "storage_bucket"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "distribution_bucket_family_metadata" ADD CONSTRAINT "FK_dd93ca0ea24f3e7a02f11c4c149" FOREIGN KEY ("family_id") REFERENCES "distribution_bucket_family"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "distribution_bucket_operator_metadata" ADD CONSTRAINT "FK_69ec9bdc975b95f7dff94a71069" FOREIGN KEY ("distirbution_bucket_operator_id") REFERENCES "distribution_bucket_operator"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "video_hero" ADD CONSTRAINT "FK_9feac5d9713a9f07e32eb8ba7a1" FOREIGN KEY ("video_id") REFERENCES "video"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "video_media_metadata" ADD CONSTRAINT "FK_5944dc5896cb16bd395414a0ce0" FOREIGN KEY ("encoding_id") REFERENCES "video_media_encoding"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) + await db.query(`ALTER TABLE "video_media_metadata" ADD CONSTRAINT "FK_4dc101240e8e1536b770aee202a" FOREIGN KEY ("video_id") REFERENCES "video"("id") ON DELETE NO ACTION ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED`) } async down(db) { @@ -280,33 +281,17 @@ module.exports = class Data1686758014971 { await db.query(`DROP INDEX "public"."IDX_2db879ed42e3308fe65e679672"`) await db.query(`DROP INDEX "public"."IDX_54f88a7decf7d22fd9bd9fa439"`) await db.query(`DROP INDEX "public"."IDX_6c49ad08c44d36d11f77c426e4"`) + await db.query(`DROP INDEX "public"."IDX_f33816960d690ac836f5d5c28a"`) await db.query(`DROP TABLE "owned_nft"`) await db.query(`DROP INDEX "public"."IDX_466896e39b9ec953f4f2545622"`) - await db.query(`DROP TABLE "storage_bucket_operator_metadata"`) - await db.query(`DROP INDEX "public"."IDX_7beffc9530b3f307bc1169cb52"`) - await db.query(`DROP TABLE "distribution_bucket_family_metadata"`) - await db.query(`DROP INDEX "public"."IDX_dd93ca0ea24f3e7a02f11c4c14"`) - await db.query(`DROP INDEX "public"."IDX_5510d3b244a63d6ec702faa426"`) - await db.query(`DROP TABLE "distribution_bucket_operator_metadata"`) - await db.query(`DROP INDEX "public"."IDX_69ec9bdc975b95f7dff94a7106"`) - await db.query(`DROP TABLE "event"`) - await db.query(`DROP INDEX "public"."IDX_8f3f220c4e717207d841d4e6d4"`) - await db.query(`DROP TABLE "notification"`) - await db.query(`DROP INDEX "public"."IDX_ac8de39626657d3c0e909d9d82"`) - await db.query(`DROP INDEX "public"."IDX_122be1f0696e0255acf95f9e33"`) - await db.query(`DROP TABLE "nft_history_entry"`) - await db.query(`DROP INDEX "public"."IDX_57f51d35ecab042478fe2e31c1"`) - await db.query(`DROP INDEX "public"."IDX_d1a28b178f5d028d048d40ce20"`) - await db.query(`DROP TABLE "nft_activity"`) - await db.query(`DROP INDEX "public"."IDX_18a65713a9fd0715c7a980f5d5"`) - await db.query(`DROP INDEX "public"."IDX_94d325a753f2c08fdd416eb095"`) - await db.query(`DROP TABLE "member_metadata"`) - await db.query(`DROP INDEX "public"."IDX_e7e4d350f82ae2383894f465ed"`) await db.query(`DROP TABLE "curator_group"`) await db.query(`DROP TABLE "curator"`) await db.query(`DROP TABLE "channel_follow"`) await db.query(`DROP INDEX "public"."IDX_822778b4b1ea8e3b60b127cb8b"`) await db.query(`DROP INDEX "public"."IDX_9bc0651dda94437ec18764a260"`) + await db.query(`DROP TABLE "video_view_event"`) + await db.query(`DROP INDEX "public"."IDX_2e29fba63e12a2b1818e0782d7"`) + await db.query(`DROP INDEX "public"."IDX_31e1e798ec387ad905cf98d33b"`) await db.query(`DROP TABLE "report"`) await db.query(`DROP INDEX "public"."IDX_c6686efa4cd49fa9a429f01bac"`) await db.query(`DROP INDEX "public"."IDX_893057921f4b5cc37a0ef36684"`) @@ -315,16 +300,6 @@ module.exports = class Data1686758014971 { await db.query(`DROP INDEX "public"."IDX_519be2a41216c278c35f254dcb"`) await db.query(`DROP INDEX "public"."IDX_76d87e26cce72ac2e7ffa28dfb"`) await db.query(`DROP TABLE "user"`) - await db.query(`DROP TABLE "video_view_event"`) - await db.query(`DROP INDEX "public"."IDX_2e29fba63e12a2b1818e0782d7"`) - await db.query(`DROP INDEX "public"."IDX_31e1e798ec387ad905cf98d33b"`) - await db.query(`DROP TABLE "gateway_config"`) - await db.query(`DROP TABLE "video_hero"`) - await db.query(`DROP INDEX "public"."IDX_9feac5d9713a9f07e32eb8ba7a"`) - await db.query(`DROP TABLE "video_media_encoding"`) - await db.query(`DROP TABLE "video_media_metadata"`) - await db.query(`DROP INDEX "public"."IDX_5944dc5896cb16bd395414a0ce"`) - await db.query(`DROP INDEX "public"."IDX_4dc101240e8e1536b770aee202"`) await db.query(`DROP TABLE "account"`) await db.query(`DROP INDEX "public"."IDX_efef1e5fdbe318a379c06678c5"`) await db.query(`DROP INDEX "public"."IDX_4c8f96ccf523e9a3faefd5bdd4"`) @@ -340,6 +315,33 @@ module.exports = class Data1686758014971 { await db.query(`DROP INDEX "public"."IDX_3612880efd8926a17eba5ab0e1"`) await db.query(`DROP TABLE "token"`) await db.query(`DROP INDEX "public"."IDX_a6fe18c105f85a63d761ccb078"`) + await db.query(`DROP TABLE "event"`) + await db.query(`DROP INDEX "public"."IDX_8f3f220c4e717207d841d4e6d4"`) + await db.query(`DROP TABLE "notification"`) + await db.query(`DROP INDEX "public"."IDX_ac8de39626657d3c0e909d9d82"`) + await db.query(`DROP INDEX "public"."IDX_122be1f0696e0255acf95f9e33"`) + await db.query(`DROP TABLE "nft_history_entry"`) + await db.query(`DROP INDEX "public"."IDX_57f51d35ecab042478fe2e31c1"`) + await db.query(`DROP INDEX "public"."IDX_d1a28b178f5d028d048d40ce20"`) + await db.query(`DROP TABLE "nft_activity"`) + await db.query(`DROP INDEX "public"."IDX_18a65713a9fd0715c7a980f5d5"`) + await db.query(`DROP INDEX "public"."IDX_94d325a753f2c08fdd416eb095"`) + await db.query(`DROP TABLE "gateway_config"`) + await db.query(`DROP TABLE "member_metadata"`) + await db.query(`DROP INDEX "public"."IDX_e7e4d350f82ae2383894f465ed"`) + await db.query(`DROP TABLE "storage_bucket_operator_metadata"`) + await db.query(`DROP INDEX "public"."IDX_7beffc9530b3f307bc1169cb52"`) + await db.query(`DROP TABLE "distribution_bucket_family_metadata"`) + await db.query(`DROP INDEX "public"."IDX_dd93ca0ea24f3e7a02f11c4c14"`) + await db.query(`DROP INDEX "public"."IDX_5510d3b244a63d6ec702faa426"`) + await db.query(`DROP TABLE "distribution_bucket_operator_metadata"`) + await db.query(`DROP INDEX "public"."IDX_69ec9bdc975b95f7dff94a7106"`) + await db.query(`DROP TABLE "video_hero"`) + await db.query(`DROP INDEX "public"."IDX_9feac5d9713a9f07e32eb8ba7a"`) + await db.query(`DROP TABLE "video_media_encoding"`) + await db.query(`DROP TABLE "video_media_metadata"`) + await db.query(`DROP INDEX "public"."IDX_5944dc5896cb16bd395414a0ce"`) + await db.query(`DROP INDEX "public"."IDX_4dc101240e8e1536b770aee202"`) await db.query(`DROP TABLE "next_entity_id"`) await db.query(`ALTER TABLE "bid" DROP CONSTRAINT "FK_9e594e5a61c0f3cb25679f6ba8d"`) await db.query(`ALTER TABLE "bid" DROP CONSTRAINT "FK_3caf2d6b31d2fe45a2b85b81912"`) @@ -385,23 +387,10 @@ module.exports = class Data1686758014971 { await db.query(`ALTER TABLE "video" DROP CONSTRAINT "FK_54f88a7decf7d22fd9bd9fa439a"`) await db.query(`ALTER TABLE "video" DROP CONSTRAINT "FK_6c49ad08c44d36d11f77c426e43"`) await db.query(`ALTER TABLE "owned_nft" DROP CONSTRAINT "FK_466896e39b9ec953f4f2545622d"`) - await db.query(`ALTER TABLE "storage_bucket_operator_metadata" DROP CONSTRAINT "FK_7beffc9530b3f307bc1169cb524"`) - await db.query(`ALTER TABLE "distribution_bucket_family_metadata" DROP CONSTRAINT "FK_dd93ca0ea24f3e7a02f11c4c149"`) - await db.query(`ALTER TABLE "distribution_bucket_operator_metadata" DROP CONSTRAINT "FK_69ec9bdc975b95f7dff94a71069"`) - await db.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_ac8de39626657d3c0e909d9d82f"`) - await db.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_122be1f0696e0255acf95f9e336"`) - await db.query(`ALTER TABLE "nft_history_entry" DROP CONSTRAINT "FK_57f51d35ecab042478fe2e31c19"`) - await db.query(`ALTER TABLE "nft_history_entry" DROP CONSTRAINT "FK_d1a28b178f5d028d048d40ce208"`) - await db.query(`ALTER TABLE "nft_activity" DROP CONSTRAINT "FK_18a65713a9fd0715c7a980f5d54"`) - await db.query(`ALTER TABLE "nft_activity" DROP CONSTRAINT "FK_94d325a753f2c08fdd416eb095f"`) - await db.query(`ALTER TABLE "member_metadata" DROP CONSTRAINT "FK_e7e4d350f82ae2383894f465ede"`) await db.query(`ALTER TABLE "channel_follow" DROP CONSTRAINT "FK_822778b4b1ea8e3b60b127cb8b1"`) + await db.query(`ALTER TABLE "video_view_event" DROP CONSTRAINT "FK_31e1e798ec387ad905cf98d33b0"`) await db.query(`ALTER TABLE "report" DROP CONSTRAINT "FK_c6686efa4cd49fa9a429f01bac8"`) await db.query(`ALTER TABLE "nft_featuring_request" DROP CONSTRAINT "FK_519be2a41216c278c35f254dcba"`) - await db.query(`ALTER TABLE "video_view_event" DROP CONSTRAINT "FK_31e1e798ec387ad905cf98d33b0"`) - await db.query(`ALTER TABLE "video_hero" DROP CONSTRAINT "FK_9feac5d9713a9f07e32eb8ba7a1"`) - await db.query(`ALTER TABLE "video_media_metadata" DROP CONSTRAINT "FK_5944dc5896cb16bd395414a0ce0"`) - await db.query(`ALTER TABLE "video_media_metadata" DROP CONSTRAINT "FK_4dc101240e8e1536b770aee202a"`) await db.query(`ALTER TABLE "account" DROP CONSTRAINT "FK_efef1e5fdbe318a379c06678c51"`) await db.query(`ALTER TABLE "account" DROP CONSTRAINT "FK_601b93655bcbe73cb58d8c80cd3"`) await db.query(`ALTER TABLE "encryption_artifacts" DROP CONSTRAINT "FK_ec8f68a544aadc4fbdadefe4a0a"`) @@ -409,5 +398,18 @@ module.exports = class Data1686758014971 { await db.query(`ALTER TABLE "session" DROP CONSTRAINT "FK_fae5a6b4a57f098e9af8520d499"`) await db.query(`ALTER TABLE "session_encryption_artifacts" DROP CONSTRAINT "FK_3612880efd8926a17eba5ab0e1a"`) await db.query(`ALTER TABLE "token" DROP CONSTRAINT "FK_a6fe18c105f85a63d761ccb0780"`) + await db.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_ac8de39626657d3c0e909d9d82f"`) + await db.query(`ALTER TABLE "notification" DROP CONSTRAINT "FK_122be1f0696e0255acf95f9e336"`) + await db.query(`ALTER TABLE "nft_history_entry" DROP CONSTRAINT "FK_57f51d35ecab042478fe2e31c19"`) + await db.query(`ALTER TABLE "nft_history_entry" DROP CONSTRAINT "FK_d1a28b178f5d028d048d40ce208"`) + await db.query(`ALTER TABLE "nft_activity" DROP CONSTRAINT "FK_18a65713a9fd0715c7a980f5d54"`) + await db.query(`ALTER TABLE "nft_activity" DROP CONSTRAINT "FK_94d325a753f2c08fdd416eb095f"`) + await db.query(`ALTER TABLE "member_metadata" DROP CONSTRAINT "FK_e7e4d350f82ae2383894f465ede"`) + await db.query(`ALTER TABLE "storage_bucket_operator_metadata" DROP CONSTRAINT "FK_7beffc9530b3f307bc1169cb524"`) + await db.query(`ALTER TABLE "distribution_bucket_family_metadata" DROP CONSTRAINT "FK_dd93ca0ea24f3e7a02f11c4c149"`) + await db.query(`ALTER TABLE "distribution_bucket_operator_metadata" DROP CONSTRAINT "FK_69ec9bdc975b95f7dff94a71069"`) + await db.query(`ALTER TABLE "video_hero" DROP CONSTRAINT "FK_9feac5d9713a9f07e32eb8ba7a1"`) + await db.query(`ALTER TABLE "video_media_metadata" DROP CONSTRAINT "FK_5944dc5896cb16bd395414a0ce0"`) + await db.query(`ALTER TABLE "video_media_metadata" DROP CONSTRAINT "FK_4dc101240e8e1536b770aee202a"`) } } diff --git a/docs/developer-guide/tutorials/updating-schema.md b/docs/developer-guide/tutorials/updating-schema.md index 29df57bd3..6178bcc6f 100644 --- a/docs/developer-guide/tutorials/updating-schema.md +++ b/docs/developer-guide/tutorials/updating-schema.md @@ -31,7 +31,7 @@ In order to do that, you'll need to: # docker-compose down -v docker-compose up -d orion_db # Generate the new migration - make dbegen + make dbgen ``` 5. You can now update the event handlers like `processVideoCreatedEvent` and `processVideoUpdatedEvent` to include the logic associated with the new field: ```typescript diff --git a/schema/videos.graphql b/schema/videos.graphql index c039caac3..9c96d0999 100644 --- a/schema/videos.graphql +++ b/schema/videos.graphql @@ -122,7 +122,7 @@ type Video @entity { ytVideoId: String "Video relevance score based on the views, reactions, comments and update date" - videoRelevance: Float! + videoRelevance: Float! @index } type VideoFeaturedInCategory @entity @index(fields: ["category", "video"], unique: true) { diff --git a/src/model/generated/index.ts b/src/model/generated/index.ts deleted file mode 100644 index a23f50ee4..000000000 --- a/src/model/generated/index.ts +++ /dev/null @@ -1,130 +0,0 @@ -export * from "./ownedNft.model" -export * from "./_nftOwner" -export * from "./_nftOwnerChannel" -export * from "./_nftOwnerMember" -export * from "./_transactionalStatus" -export * from "./_transactionalStatusIdle" -export * from "./_transactionalStatusInitiatedOfferToMember" -export * from "./_transactionalStatusBuyNow" -export * from "./_transactionalStatusAuction" -export * from "./auction.model" -export * from "./_auctionType" -export * from "./_auctionTypeEnglish" -export * from "./_auctionTypeOpen" -export * from "./auctionWhitelistedMember.model" -export * from "./bid.model" -export * from "./storageBucketOperatorMetadata.model" -export * from "./_nodeLocationMetadata" -export * from "./_geoCoordinates" -export * from "./storageBucket.model" -export * from "./_storageBucketOperatorStatus" -export * from "./_storageBucketOperatorStatusMissing" -export * from "./_storageBucketOperatorStatusInvited" -export * from "./_storageBucketOperatorStatusActive" -export * from "./storageBag.model" -export * from "./_storageBagOwner" -export * from "./_storageBagOwnerCouncil" -export * from "./_storageBagOwnerWorkingGroup" -export * from "./_storageBagOwnerMember" -export * from "./_storageBagOwnerChannel" -export * from "./_storageBagOwnerDao" -export * from "./storageBucketBag.model" -export * from "./distributionBucketBag.model" -export * from "./storageDataObject.model" -export * from "./_dataObjectType" -export * from "./_dataObjectTypeChannelAvatar" -export * from "./_dataObjectTypeChannelCoverPhoto" -export * from "./_dataObjectTypeVideoMedia" -export * from "./_dataObjectTypeVideoThumbnail" -export * from "./_dataObjectTypeVideoSubtitle" -export * from "./_dataObjectTypeChannelPayoutsPayload" -export * from "./distributionBucketFamilyMetadata.model" -export * from "./_geographicalArea" -export * from "./_geographicalAreaContinent" -export * from "./_continent" -export * from "./_geographicalAreaCountry" -export * from "./_geographicalAreaSubdivistion" -export * from "./distributionBucketOperatorMetadata.model" -export * from "./distributionBucketOperator.model" -export * from "./_distributionBucketOperatorStatus" -export * from "./distributionBucket.model" -export * from "./distributionBucketFamily.model" -export * from "./channel.model" -export * from "./bannedMember.model" -export * from "./event.model" -export * from "./_eventData" -export * from "./_commentCreatedEventData" -export * from "./_commentTextUpdatedEventData" -export * from "./_openAuctionStartedEventData" -export * from "./_contentActor" -export * from "./_contentActorCurator" -export * from "./_contentActorMember" -export * from "./_contentActorLead" -export * from "./_englishAuctionStartedEventData" -export * from "./_nftIssuedEventData" -export * from "./_auctionBidMadeEventData" -export * from "./_auctionBidCanceledEventData" -export * from "./_auctionCanceledEventData" -export * from "./_englishAuctionSettledEventData" -export * from "./_bidMadeCompletingAuctionEventData" -export * from "./_openAuctionBidAcceptedEventData" -export * from "./_nftSellOrderMadeEventData" -export * from "./_nftBoughtEventData" -export * from "./_buyNowCanceledEventData" -export * from "./_buyNowPriceUpdatedEventData" -export * from "./_metaprotocolTransactionStatusEventData" -export * from "./_metaprotocolTransactionResult" -export * from "./_metaprotocolTransactionResultOk" -export * from "./_metaprotocolTransactionResultCommentCreated" -export * from "./_metaprotocolTransactionResultCommentEdited" -export * from "./_metaprotocolTransactionResultCommentDeleted" -export * from "./_metaprotocolTransactionResultCommentModerated" -export * from "./_metaprotocolTransactionResultFailed" -export * from "./_metaprotocolTransactionResultChannelPaid" -export * from "./_channelRewardClaimedEventData" -export * from "./_channelRewardClaimedAndWithdrawnEventData" -export * from "./_channelFundsWithdrawnEventData" -export * from "./_channelPayoutsUpdatedEventData" -export * from "./_channelPaymentMadeEventData" -export * from "./_paymentContext" -export * from "./_paymentContextVideo" -export * from "./_paymentContextChannel" -export * from "./_memberBannedFromChannelEventData" -export * from "./notification.model" -export * from "./nftHistoryEntry.model" -export * from "./nftActivity.model" -export * from "./memberMetadata.model" -export * from "./_avatar" -export * from "./_avatarObject" -export * from "./_avatarUri" -export * from "./membership.model" -export * from "./commentReaction.model" -export * from "./comment.model" -export * from "./_commentStatus" -export * from "./_commentReactionsCountByReactionId" -export * from "./curatorGroup.model" -export * from "./curator.model" -export * from "./videoViewEvent.model" -export * from "./report.model" -export * from "./nftFeaturingRequest.model" -export * from "./channelFollow.model" -export * from "./gatewayConfig.model" -export * from "./videoCategory.model" -export * from "./video.model" -export * from "./_videoReactionsCountByReactionType" -export * from "./_videoReactionOptions" -export * from "./videoFeaturedInCategory.model" -export * from "./videoHero.model" -export * from "./videoMediaMetadata.model" -export * from "./videoMediaEncoding.model" -export * from "./license.model" -export * from "./videoSubtitle.model" -export * from "./videoReaction.model" -export * from "./app.model" -export * from "./user.model" -export * from "./encryptionArtifacts.model" -export * from "./sessionEncryptionArtifacts.model" -export * from "./session.model" -export * from "./account.model" -export * from "./token.model" -export * from "./_tokenType" diff --git a/src/model/generated/marshal.ts b/src/model/generated/marshal.ts deleted file mode 100644 index eaf8d36a8..000000000 --- a/src/model/generated/marshal.ts +++ /dev/null @@ -1,179 +0,0 @@ -import assert from 'assert' - - -export interface Marshal { - fromJSON(value: unknown): T - toJSON(value: T): S -} - - -export const string: Marshal = { - fromJSON(value: unknown): string { - assert(typeof value === 'string', 'invalid String') - return value - }, - toJSON(value) { - return value - } -} - - -export const id = string - - -export const int: Marshal = { - fromJSON(value: unknown): number { - assert(Number.isInteger(value), 'invalid Int') - return value as number - }, - toJSON(value) { - return value - } -} - - -export const float: Marshal = { - fromJSON(value: unknown): number { - assert(typeof value === 'number', 'invalid Float') - return value as number - }, - toJSON(value) { - return value - } -} - - -export const boolean: Marshal = { - fromJSON(value: unknown): boolean { - assert(typeof value === 'boolean', 'invalid Boolean') - return value - }, - toJSON(value: boolean): boolean { - return value - } -} - - -export const bigint: Marshal = { - fromJSON(value: unknown): bigint { - assert(typeof value === 'string', 'invalid BigInt') - return BigInt(value) - }, - toJSON(value: bigint): string { - return value.toString() - } -} - - -export const bigdecimal: Marshal = { - fromJSON(value: unknown): bigint { - assert(typeof value === 'string', 'invalid BigDecimal') - return decimal.BigDecimal(value) - }, - toJSON(value: any): string { - return value.toString() - } -} - - -// credit - https://github.com/Urigo/graphql-scalars/blob/91b4ea8df891be8af7904cf84751930cc0c6613d/src/scalars/iso-date/validator.ts#L122 -const RFC_3339_REGEX = - /^(\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60))(\.\d{1,})?([Z])$/ - - -function isIsoDateTimeString(s: string): boolean { - return RFC_3339_REGEX.test(s) -} - - -export const datetime: Marshal = { - fromJSON(value: unknown): Date { - assert(typeof value === 'string', 'invalid DateTime') - assert(isIsoDateTimeString(value), 'invalid DateTime') - return new Date(value) - }, - toJSON(value: Date): string { - return value.toISOString() - } -} - - -export const bytes: Marshal = { - fromJSON(value: unknown): Buffer { - assert(typeof value === 'string', 'invalid Bytes') - assert(value.length % 2 === 0, 'invalid Bytes') - assert(/^0x[0-9a-f]+$/i.test(value), 'invalid Bytes') - return Buffer.from(value.slice(2), 'hex') - }, - toJSON(value: Uint8Array): string { - if (Buffer.isBuffer(value)) { - return '0x' + value.toString('hex') - } else { - return '0x' + Buffer.from(value.buffer, value.byteOffset, value.byteLength).toString('hex') - } - } -} - - -export function fromList(list: unknown, f: (val: unknown) => T): T[] { - assert(Array.isArray(list)) - return list.map((val) => f(val)) -} - - -export function nonNull(val: T | undefined | null): T { - assert(val != null, 'non-nullable value is null') - return val -} - - -export const bigintTransformer = { - to(x?: bigint) { - return x?.toString() - }, - from(s?: string): bigint | undefined { - return s == null ? undefined : BigInt(s) - } -} - - -export const floatTransformer = { - to(x?: number) { - return x?.toString() - }, - from(s?: string): number | undefined { - return s == null ? undefined : Number(s) - } -} - - -export const bigdecimalTransformer = { - to(x?: any) { - return x?.toString() - }, - from(s?: any): any | undefined { - return s == null ? undefined : decimal.BigDecimal(s) - } -} - - -export function enumFromJson(json: unknown, enumObject: E): E[keyof E] { - assert(typeof json == 'string', 'invalid enum value') - let val = (enumObject as any)[json] - assert(typeof val == 'string', `invalid enum value`) - return val as any -} - - -const decimal = { - get BigDecimal(): any { - throw new Error('Package `@subsquid/big-decimal` is not installed') - } -} - - -try { - Object.defineProperty(decimal, "BigDecimal", { - value: require('@subsquid/big-decimal').BigDecimal - }) -} catch (e) {}