From 3285a59afcecc4903635f13c8281f44838932af1 Mon Sep 17 00:00:00 2001 From: KagChi Date: Sun, 2 Jun 2024 18:42:14 +0700 Subject: [PATCH] feat: update schema --- drizzle/0004_lush_jean_grey.sql | 15 + drizzle/meta/0004_snapshot.json | 793 ++++++++++++++++++++++++++++++++ drizzle/meta/_journal.json | 7 + package.json | 2 +- pnpm-lock.yaml | 10 +- 5 files changed, 821 insertions(+), 6 deletions(-) create mode 100644 drizzle/0004_lush_jean_grey.sql create mode 100644 drizzle/meta/0004_snapshot.json diff --git a/drizzle/0004_lush_jean_grey.sql b/drizzle/0004_lush_jean_grey.sql new file mode 100644 index 0000000..3a8c2b8 --- /dev/null +++ b/drizzle/0004_lush_jean_grey.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS "gapless" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "guild_id" uuid, + "client_id" text, + "activated_by" text, + "state" boolean DEFAULT false, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp NOT NULL +); +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "gapless" ADD CONSTRAINT "gapless_guild_id_guild_id_fk" FOREIGN KEY ("guild_id") REFERENCES "public"."guild"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/drizzle/meta/0004_snapshot.json b/drizzle/meta/0004_snapshot.json new file mode 100644 index 0000000..bb8da74 --- /dev/null +++ b/drizzle/meta/0004_snapshot.json @@ -0,0 +1,793 @@ +{ + "id": "f4465932-0112-4e3c-9bda-58aa0fe3e9eb", + "prevId": "fa8827ba-74f8-423b-a0e9-684aff21e9a4", + "version": "6", + "dialect": "postgresql", + "tables": { + "public.activation_key": { + "name": "activation_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "tier": { + "name": "tier", + "type": "TierType", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'FREE'" + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "guild_id": { + "name": "guild_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "start_at": { + "name": "start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "ends_at": { + "name": "ends_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "activation_key_guild_id_guild_id_fk": { + "name": "activation_key_guild_id_guild_id_fk", + "tableFrom": "activation_key", + "tableTo": "guild", + "columnsFrom": [ + "guild_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "activation_key_user_id_user_id_fk": { + "name": "activation_key_user_id_user_id_fk", + "tableFrom": "activation_key", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.crossfade": { + "name": "crossfade", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "guild_id": { + "name": "guild_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activated_by": { + "name": "activated_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "crossfade_guild_id_guild_id_fk": { + "name": "crossfade_guild_id_guild_id_fk", + "tableFrom": "crossfade", + "tableTo": "guild", + "columnsFrom": [ + "guild_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.dj": { + "name": "dj", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "guild_id": { + "name": "guild_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activated_by": { + "name": "activated_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "users": { + "name": "users", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'::text[]" + }, + "roles": { + "name": "roles", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'::text[]" + } + }, + "indexes": {}, + "foreignKeys": { + "dj_guild_id_guild_id_fk": { + "name": "dj_guild_id_guild_id_fk", + "tableFrom": "dj", + "tableTo": "guild", + "columnsFrom": [ + "guild_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.default_volume": { + "name": "default_volume", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "guild_id": { + "name": "guild_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activated_by": { + "name": "activated_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 100 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "default_volume_guild_id_guild_id_fk": { + "name": "default_volume_guild_id_guild_id_fk", + "tableFrom": "default_volume", + "tableTo": "guild", + "columnsFrom": [ + "guild_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.gapless": { + "name": "gapless", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "guild_id": { + "name": "guild_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activated_by": { + "name": "activated_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "gapless_guild_id_guild_id_fk": { + "name": "gapless_guild_id_guild_id_fk", + "tableFrom": "gapless", + "tableTo": "guild", + "columnsFrom": [ + "guild_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.guild": { + "name": "guild", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "key_id": { + "name": "key_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.stay_in_vc": { + "name": "stay_in_vc", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "guild_id": { + "name": "guild_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "activated_by": { + "name": "activated_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "stay_in_vc_guild_id_guild_id_fk": { + "name": "stay_in_vc_guild_id_guild_id_fk", + "tableFrom": "stay_in_vc", + "tableTo": "guild", + "columnsFrom": [ + "guild_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "discord_id": { + "name": "discord_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "patreon_id": { + "name": "patreon_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "premium_provider": { + "name": "premium_provider", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'UNKNOWN'" + }, + "premium_tier": { + "name": "premium_tier", + "type": "TierType", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'FREE'" + }, + "premium_start_at": { + "name": "premium_start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "premium_ends_at": { + "name": "premium_ends_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "voted_at": { + "name": "voted_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_discord_id_unique": { + "name": "user_discord_id_unique", + "nullsNotDistinct": false, + "columns": [ + "discord_id" + ] + }, + "user_patreon_id_unique": { + "name": "user_patreon_id_unique", + "nullsNotDistinct": false, + "columns": [ + "patreon_id" + ] + } + } + }, + "public.playlist": { + "name": "playlist", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "visibility": { + "name": "visibility", + "type": "Visibility", + "typeSchema": "public", + "primaryKey": false, + "notNull": false, + "default": "'PUBLIC'" + }, + "track_limit": { + "name": "track_limit", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 20 + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "playlist_external_id_unique": { + "name": "playlist_external_id_unique", + "nullsNotDistinct": false, + "columns": [ + "external_id" + ] + } + } + }, + "public.playlist_track": { + "name": "playlist_track", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "playlist_id": { + "name": "playlist_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "track": { + "name": "track", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "playlist_track_playlist_id_playlist_id_fk": { + "name": "playlist_track_playlist_id_playlist_id_fk", + "tableFrom": "playlist_track", + "tableTo": "playlist", + "columnsFrom": [ + "playlist_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "playlist_track_external_id_unique": { + "name": "playlist_track_external_id_unique", + "nullsNotDistinct": false, + "columns": [ + "external_id" + ] + } + } + } + }, + "enums": { + "public.TierType": { + "name": "TierType", + "schema": "public", + "values": [ + "FREE", + "SUPPORTER", + "TIER_1", + "TIER_2", + "TIER_3" + ] + }, + "public.Visibility": { + "name": "Visibility", + "schema": "public", + "values": [ + "PUBLIC", + "PRIVATE" + ] + } + }, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index 1d038e7..b58fda2 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -29,6 +29,13 @@ "when": 1717076719413, "tag": "0003_sad_saracen", "breakpoints": true + }, + { + "idx": 4, + "version": "6", + "when": 1717325681646, + "tag": "0004_lush_jean_grey", + "breakpoints": true } ] } \ No newline at end of file diff --git a/package.json b/package.json index 8d54090..d304265 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "typescript": "^5.4.5" }, "dependencies": { - "@nezuchan/schema": "^0.1.1", + "@nezuchan/schema": "^0.1.2", "drizzle-orm": "^0.30.10", "hyper-express": "^6.16.2", "pg": "^8.11.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index da4fe10..392d6a3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@nezuchan/schema': - specifier: ^0.1.1 - version: 0.1.1(@types/pg@8.11.6)(pg@8.11.5) + specifier: ^0.1.2 + version: 0.1.2(@types/pg@8.11.6)(pg@8.11.5) drizzle-orm: specifier: ^0.30.10 version: 0.30.10(@types/pg@8.11.6)(pg@8.11.5) @@ -424,8 +424,8 @@ packages: resolution: {integrity: sha512-sTGoeZnjI8N4KS+sW2AN95gDBErhAguvkw/tWdCjeM8bvxpz5lqrnd0vOJABA1A+Ic3zED7PYoLP/RANLgVotA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - '@nezuchan/schema@0.1.1': - resolution: {integrity: sha512-gPX+RF3ssxhurv6zgST/GhLynuXNo/brWnnuFsw7KVqmjeB7TfP6LHUsPbMb3Y3Qpgm//1zwS4enNzpSo8q54Q==} + '@nezuchan/schema@0.1.2': + resolution: {integrity: sha512-/M/PS14t/tgV6CtG0lxoYeublX8naPoQpWEbN5Fhew57jkElVXJDyG/1oL7lhqKd/ruw1GSn6CZBvDiFsPoVKg==} '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} @@ -2845,7 +2845,7 @@ snapshots: got: 11.8.6 os-filter-obj: 2.0.0 - '@nezuchan/schema@0.1.1(@types/pg@8.11.6)(pg@8.11.5)': + '@nezuchan/schema@0.1.2(@types/pg@8.11.6)(pg@8.11.5)': dependencies: '@sapphire/pieces': 4.2.2 '@sapphire/utilities': 3.16.2