update
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE "user" ADD COLUMN "username" text;--> statement-breakpoint
|
||||
ALTER TABLE "user" ADD COLUMN "bio" text;--> statement-breakpoint
|
||||
ALTER TABLE "user" ADD CONSTRAINT "user_username_key" UNIQUE("username");
|
||||
@@ -0,0 +1,115 @@
|
||||
{
|
||||
"type": "diff",
|
||||
"version": "10",
|
||||
"dialect": "postgres",
|
||||
"id": "599a945d-6169-416b-9398-fe17247d8d99",
|
||||
"prevIds": [
|
||||
"2041e3a9-973b-4348-98e7-0c5a0587d428"
|
||||
],
|
||||
"footprints": [
|
||||
{
|
||||
"statementType": "add_column",
|
||||
"statementTarget": [
|
||||
"column",
|
||||
"public",
|
||||
"user",
|
||||
"username"
|
||||
],
|
||||
"writes": [
|
||||
"s|col|public.user.username",
|
||||
"n|col|public.user.username",
|
||||
"e|col|public.user.username"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.user",
|
||||
"n|sch|public"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "add_column",
|
||||
"statementTarget": [
|
||||
"column",
|
||||
"public",
|
||||
"user",
|
||||
"bio"
|
||||
],
|
||||
"writes": [
|
||||
"s|col|public.user.bio",
|
||||
"n|col|public.user.bio",
|
||||
"e|col|public.user.bio"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.user",
|
||||
"n|sch|public"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "add_unique",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"user"
|
||||
],
|
||||
"writes": [
|
||||
"s|uq|public.user.user_username_key",
|
||||
"n|uq|public.user.user_username_key",
|
||||
"e|uq|public.user.user_username_key",
|
||||
"n|con|public.user.user_username_key",
|
||||
"n|rel|public.user_username_key"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.user",
|
||||
"n|sch|public",
|
||||
"n|col|public.user.username"
|
||||
]
|
||||
}
|
||||
],
|
||||
"deltas": [
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "user",
|
||||
"name": "username",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "user",
|
||||
"name": "bio",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "user",
|
||||
"name": "user_username_key",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"username"
|
||||
],
|
||||
"nullsNotDistinct": false,
|
||||
"entityType": "uniques"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
CREATE TYPE "conversation_type" AS ENUM('direct');--> statement-breakpoint
|
||||
CREATE TYPE "friendship_status" AS ENUM('pending', 'accepted');--> statement-breakpoint
|
||||
CREATE TABLE "conversation" (
|
||||
"id" uuid PRIMARY KEY DEFAULT uuidv7(),
|
||||
"type" "conversation_type" NOT NULL,
|
||||
"direct_key" text UNIQUE,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"last_activity_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "conversation_member" (
|
||||
"conversation_id" uuid,
|
||||
"user_id" text,
|
||||
"joined_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "conversation_member_pkey" PRIMARY KEY("conversation_id","user_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "message" (
|
||||
"id" uuid PRIMARY KEY DEFAULT uuidv7(),
|
||||
"conversation_id" uuid NOT NULL,
|
||||
"author_id" text NOT NULL,
|
||||
"content" text NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "friendship" (
|
||||
"user_low_id" text,
|
||||
"user_high_id" text,
|
||||
"requested_by_id" text NOT NULL,
|
||||
"status" "friendship_status" DEFAULT 'pending'::"friendship_status" NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"accepted_at" timestamp with time zone,
|
||||
CONSTRAINT "friendship_pkey" PRIMARY KEY("user_low_id","user_high_id"),
|
||||
CONSTRAINT "friendship_ordered_pair" CHECK ("user_low_id" < "user_high_id" COLLATE "C")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX "conversation_member_user_id_idx" ON "conversation_member" ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "message_conversation_id_id_idx" ON "message" ("conversation_id","id");--> statement-breakpoint
|
||||
CREATE INDEX "friendship_user_high_id_idx" ON "friendship" ("user_high_id");--> statement-breakpoint
|
||||
ALTER TABLE "conversation_member" ADD CONSTRAINT "conversation_member_conversation_id_conversation_id_fkey" FOREIGN KEY ("conversation_id") REFERENCES "conversation"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "conversation_member" ADD CONSTRAINT "conversation_member_user_id_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "message" ADD CONSTRAINT "message_conversation_id_conversation_id_fkey" FOREIGN KEY ("conversation_id") REFERENCES "conversation"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "message" ADD CONSTRAINT "message_author_id_user_id_fkey" FOREIGN KEY ("author_id") REFERENCES "user"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "friendship" ADD CONSTRAINT "friendship_user_low_id_user_id_fkey" FOREIGN KEY ("user_low_id") REFERENCES "user"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "friendship" ADD CONSTRAINT "friendship_user_high_id_user_id_fkey" FOREIGN KEY ("user_high_id") REFERENCES "user"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "friendship" ADD CONSTRAINT "friendship_requested_by_id_user_id_fkey" FOREIGN KEY ("requested_by_id") REFERENCES "user"("id") ON DELETE CASCADE;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
ALTER TYPE "conversation_type" ADD VALUE 'group';--> statement-breakpoint
|
||||
ALTER TABLE "conversation" ADD COLUMN "name" text;--> statement-breakpoint
|
||||
ALTER TABLE "conversation" ADD COLUMN "owner_id" text;--> statement-breakpoint
|
||||
ALTER TABLE "conversation" ADD CONSTRAINT "conversation_owner_id_user_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "user"("id") ON DELETE SET NULL;
|
||||
@@ -0,0 +1,148 @@
|
||||
{
|
||||
"type": "diff",
|
||||
"version": "10",
|
||||
"dialect": "postgres",
|
||||
"id": "d8d24fdc-bb81-4b87-8ec6-6d18c20db156",
|
||||
"prevIds": [
|
||||
"093dfccd-003b-4b87-9780-15e56d12e34e"
|
||||
],
|
||||
"footprints": [
|
||||
{
|
||||
"statementType": "alter_enum",
|
||||
"statementTarget": [
|
||||
"enum",
|
||||
"public",
|
||||
"conversation_type"
|
||||
],
|
||||
"writes": [
|
||||
"s|enum|public.conversation_type"
|
||||
],
|
||||
"reads": [
|
||||
"n|sch|public"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "add_column",
|
||||
"statementTarget": [
|
||||
"column",
|
||||
"public",
|
||||
"conversation",
|
||||
"name"
|
||||
],
|
||||
"writes": [
|
||||
"s|col|public.conversation.name",
|
||||
"n|col|public.conversation.name",
|
||||
"e|col|public.conversation.name"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.conversation",
|
||||
"n|sch|public"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "add_column",
|
||||
"statementTarget": [
|
||||
"column",
|
||||
"public",
|
||||
"conversation",
|
||||
"owner_id"
|
||||
],
|
||||
"writes": [
|
||||
"s|col|public.conversation.owner_id",
|
||||
"n|col|public.conversation.owner_id",
|
||||
"e|col|public.conversation.owner_id"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.conversation",
|
||||
"n|sch|public"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"conversation"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.conversation.conversation_owner_id_user_id_fkey",
|
||||
"n|fk|public.conversation.conversation_owner_id_user_id_fkey",
|
||||
"e|fk|public.conversation.conversation_owner_id_user_id_fkey",
|
||||
"n|con|public.conversation.conversation_owner_id_user_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.conversation",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.user",
|
||||
"n|sch|public",
|
||||
"n|col|public.conversation.owner_id",
|
||||
"n|col|public.user.id",
|
||||
"e|uniqueness|public.user.id"
|
||||
]
|
||||
}
|
||||
],
|
||||
"deltas": [
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "conversation",
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "conversation",
|
||||
"name": "owner_id",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "conversation",
|
||||
"name": "conversation_owner_id_user_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"owner_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "user",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "SET NULL",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "alter",
|
||||
"key": "enums\u0000[\"public\",\"conversation_type\"]",
|
||||
"set": {
|
||||
"values": [
|
||||
"direct",
|
||||
"group"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
ALTER TYPE "conversation_type" ADD VALUE 'cauldron';--> statement-breakpoint
|
||||
CREATE TABLE "realm" (
|
||||
"id" uuid PRIMARY KEY DEFAULT uuidv7(),
|
||||
"name" text NOT NULL,
|
||||
"owner_id" text NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "realm_invite" (
|
||||
"code" text PRIMARY KEY,
|
||||
"realm_id" uuid NOT NULL,
|
||||
"created_by_id" text NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"expires_at" timestamp with time zone,
|
||||
"max_uses" integer,
|
||||
"uses" integer DEFAULT 0 NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "realm_member" (
|
||||
"realm_id" uuid,
|
||||
"user_id" text,
|
||||
"joined_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "realm_member_pkey" PRIMARY KEY("realm_id","user_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "realm_member_role" (
|
||||
"realm_id" uuid,
|
||||
"user_id" text,
|
||||
"role_id" uuid,
|
||||
CONSTRAINT "realm_member_role_pkey" PRIMARY KEY("realm_id","user_id","role_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "realm_role" (
|
||||
"id" uuid PRIMARY KEY DEFAULT uuidv7(),
|
||||
"realm_id" uuid NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"permissions" text[] NOT NULL,
|
||||
"is_default" boolean DEFAULT false NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "conversation" ADD COLUMN "realm_id" uuid;--> statement-breakpoint
|
||||
CREATE INDEX "conversation_realm_id_idx" ON "conversation" ("realm_id");--> statement-breakpoint
|
||||
CREATE INDEX "realm_invite_realm_id_idx" ON "realm_invite" ("realm_id");--> statement-breakpoint
|
||||
CREATE INDEX "realm_member_user_id_idx" ON "realm_member" ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "realm_member_role_role_id_idx" ON "realm_member_role" ("role_id");--> statement-breakpoint
|
||||
CREATE INDEX "realm_role_realm_id_idx" ON "realm_role" ("realm_id");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "realm_role_one_default_idx" ON "realm_role" ("realm_id") WHERE "is_default";--> statement-breakpoint
|
||||
ALTER TABLE "conversation" ADD CONSTRAINT "conversation_realm_id_realm_id_fkey" FOREIGN KEY ("realm_id") REFERENCES "realm"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "realm" ADD CONSTRAINT "realm_owner_id_user_id_fkey" FOREIGN KEY ("owner_id") REFERENCES "user"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "realm_invite" ADD CONSTRAINT "realm_invite_realm_id_realm_id_fkey" FOREIGN KEY ("realm_id") REFERENCES "realm"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "realm_invite" ADD CONSTRAINT "realm_invite_created_by_id_user_id_fkey" FOREIGN KEY ("created_by_id") REFERENCES "user"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "realm_member" ADD CONSTRAINT "realm_member_realm_id_realm_id_fkey" FOREIGN KEY ("realm_id") REFERENCES "realm"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "realm_member" ADD CONSTRAINT "realm_member_user_id_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "realm_member_role" ADD CONSTRAINT "realm_member_role_role_id_realm_role_id_fkey" FOREIGN KEY ("role_id") REFERENCES "realm_role"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "realm_member_role" ADD CONSTRAINT "realm_member_role_member_fk" FOREIGN KEY ("realm_id","user_id") REFERENCES "realm_member"("realm_id","user_id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "realm_role" ADD CONSTRAINT "realm_role_realm_id_realm_id_fkey" FOREIGN KEY ("realm_id") REFERENCES "realm"("id") ON DELETE CASCADE;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
CREATE TABLE "attachment" (
|
||||
"id" uuid PRIMARY KEY DEFAULT uuidv7(),
|
||||
"uploader_id" text,
|
||||
"message_id" uuid,
|
||||
"filename" text NOT NULL,
|
||||
"content_type" text NOT NULL,
|
||||
"size" integer NOT NULL,
|
||||
"width" integer,
|
||||
"height" integer,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "conversation_read" (
|
||||
"user_id" text,
|
||||
"conversation_id" uuid,
|
||||
"last_read_message_id" uuid NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "conversation_read_pkey" PRIMARY KEY("user_id","conversation_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "message_reaction" (
|
||||
"message_id" uuid,
|
||||
"user_id" text,
|
||||
"emoji" text,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "message_reaction_pkey" PRIMARY KEY("message_id","user_id","emoji")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX "attachment_message_id_idx" ON "attachment" ("message_id");--> statement-breakpoint
|
||||
CREATE INDEX "attachment_uploader_id_idx" ON "attachment" ("uploader_id");--> statement-breakpoint
|
||||
ALTER TABLE "attachment" ADD CONSTRAINT "attachment_uploader_id_user_id_fkey" FOREIGN KEY ("uploader_id") REFERENCES "user"("id") ON DELETE SET NULL;--> statement-breakpoint
|
||||
ALTER TABLE "attachment" ADD CONSTRAINT "attachment_message_id_message_id_fkey" FOREIGN KEY ("message_id") REFERENCES "message"("id") ON DELETE SET NULL;--> statement-breakpoint
|
||||
ALTER TABLE "conversation_read" ADD CONSTRAINT "conversation_read_user_id_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "conversation_read" ADD CONSTRAINT "conversation_read_conversation_id_conversation_id_fkey" FOREIGN KEY ("conversation_id") REFERENCES "conversation"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "message_reaction" ADD CONSTRAINT "message_reaction_message_id_message_id_fkey" FOREIGN KEY ("message_id") REFERENCES "message"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "message_reaction" ADD CONSTRAINT "message_reaction_user_id_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE CASCADE;
|
||||
@@ -0,0 +1,755 @@
|
||||
{
|
||||
"type": "diff",
|
||||
"version": "10",
|
||||
"dialect": "postgres",
|
||||
"id": "97862caf-8fe6-4846-b50d-6852f29dfc94",
|
||||
"prevIds": [
|
||||
"7d8afcd9-0950-488b-b642-ef874960d2b3"
|
||||
],
|
||||
"footprints": [
|
||||
{
|
||||
"statementType": "create_table",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"attachment"
|
||||
],
|
||||
"writes": [
|
||||
"s|tbl|public.attachment",
|
||||
"n|tbl|public.attachment",
|
||||
"e|tbl|public.attachment",
|
||||
"n|rel|public.attachment",
|
||||
"n|type|public.attachment",
|
||||
"n|rel|public.attachment_pkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|sch|public"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_table",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"conversation_read"
|
||||
],
|
||||
"writes": [
|
||||
"s|tbl|public.conversation_read",
|
||||
"n|tbl|public.conversation_read",
|
||||
"e|tbl|public.conversation_read",
|
||||
"n|rel|public.conversation_read",
|
||||
"n|type|public.conversation_read",
|
||||
"n|rel|public.conversation_read_pkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|sch|public"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_table",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"message_reaction"
|
||||
],
|
||||
"writes": [
|
||||
"s|tbl|public.message_reaction",
|
||||
"n|tbl|public.message_reaction",
|
||||
"e|tbl|public.message_reaction",
|
||||
"n|rel|public.message_reaction",
|
||||
"n|type|public.message_reaction",
|
||||
"n|rel|public.message_reaction_pkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|sch|public"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_index",
|
||||
"statementTarget": [
|
||||
"index",
|
||||
"public",
|
||||
"attachment",
|
||||
"attachment_message_id_idx"
|
||||
],
|
||||
"writes": [
|
||||
"s|idx|public.attachment_message_id_idx",
|
||||
"n|idx|public.attachment_message_id_idx",
|
||||
"e|idx|public.attachment_message_id_idx",
|
||||
"n|rel|public.attachment_message_id_idx"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.attachment",
|
||||
"n|sch|public",
|
||||
"n|col|public.attachment.message_id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_index",
|
||||
"statementTarget": [
|
||||
"index",
|
||||
"public",
|
||||
"attachment",
|
||||
"attachment_uploader_id_idx"
|
||||
],
|
||||
"writes": [
|
||||
"s|idx|public.attachment_uploader_id_idx",
|
||||
"n|idx|public.attachment_uploader_id_idx",
|
||||
"e|idx|public.attachment_uploader_id_idx",
|
||||
"n|rel|public.attachment_uploader_id_idx"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.attachment",
|
||||
"n|sch|public",
|
||||
"n|col|public.attachment.uploader_id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"attachment"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.attachment.attachment_uploader_id_user_id_fkey",
|
||||
"n|fk|public.attachment.attachment_uploader_id_user_id_fkey",
|
||||
"e|fk|public.attachment.attachment_uploader_id_user_id_fkey",
|
||||
"n|con|public.attachment.attachment_uploader_id_user_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.attachment",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.user",
|
||||
"n|sch|public",
|
||||
"n|col|public.attachment.uploader_id",
|
||||
"n|col|public.user.id",
|
||||
"e|uniqueness|public.user.id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"attachment"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.attachment.attachment_message_id_message_id_fkey",
|
||||
"n|fk|public.attachment.attachment_message_id_message_id_fkey",
|
||||
"e|fk|public.attachment.attachment_message_id_message_id_fkey",
|
||||
"n|con|public.attachment.attachment_message_id_message_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.attachment",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.message",
|
||||
"n|sch|public",
|
||||
"n|col|public.attachment.message_id",
|
||||
"n|col|public.message.id",
|
||||
"e|uniqueness|public.message.id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"conversation_read"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.conversation_read.conversation_read_user_id_user_id_fkey",
|
||||
"n|fk|public.conversation_read.conversation_read_user_id_user_id_fkey",
|
||||
"e|fk|public.conversation_read.conversation_read_user_id_user_id_fkey",
|
||||
"n|con|public.conversation_read.conversation_read_user_id_user_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.conversation_read",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.user",
|
||||
"n|sch|public",
|
||||
"n|col|public.conversation_read.user_id",
|
||||
"n|col|public.user.id",
|
||||
"e|uniqueness|public.user.id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"conversation_read"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.conversation_read.conversation_read_conversation_id_conversation_id_fkey",
|
||||
"n|fk|public.conversation_read.conversation_read_conversation_id_conversation_id_fkey",
|
||||
"e|fk|public.conversation_read.conversation_read_conversation_id_conversation_id_fkey",
|
||||
"n|con|public.conversation_read.conversation_read_conversation_id_conversation_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.conversation_read",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.conversation",
|
||||
"n|sch|public",
|
||||
"n|col|public.conversation_read.conversation_id",
|
||||
"n|col|public.conversation.id",
|
||||
"e|uniqueness|public.conversation.id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"message_reaction"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.message_reaction.message_reaction_message_id_message_id_fkey",
|
||||
"n|fk|public.message_reaction.message_reaction_message_id_message_id_fkey",
|
||||
"e|fk|public.message_reaction.message_reaction_message_id_message_id_fkey",
|
||||
"n|con|public.message_reaction.message_reaction_message_id_message_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.message_reaction",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.message",
|
||||
"n|sch|public",
|
||||
"n|col|public.message_reaction.message_id",
|
||||
"n|col|public.message.id",
|
||||
"e|uniqueness|public.message.id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"message_reaction"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.message_reaction.message_reaction_user_id_user_id_fkey",
|
||||
"n|fk|public.message_reaction.message_reaction_user_id_user_id_fkey",
|
||||
"e|fk|public.message_reaction.message_reaction_user_id_user_id_fkey",
|
||||
"n|con|public.message_reaction.message_reaction_user_id_user_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.message_reaction",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.user",
|
||||
"n|sch|public",
|
||||
"n|col|public.message_reaction.user_id",
|
||||
"n|col|public.user.id",
|
||||
"e|uniqueness|public.user.id"
|
||||
]
|
||||
}
|
||||
],
|
||||
"deltas": [
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"name": "attachment",
|
||||
"isRlsEnabled": false,
|
||||
"entityType": "tables"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"name": "conversation_read",
|
||||
"isRlsEnabled": false,
|
||||
"entityType": "tables"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"name": "message_reaction",
|
||||
"isRlsEnabled": false,
|
||||
"entityType": "tables"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "id",
|
||||
"type": "uuid",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "uuidv7()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "uploader_id",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "message_id",
|
||||
"type": "uuid",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "filename",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "content_type",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "size",
|
||||
"type": "integer",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "width",
|
||||
"type": "integer",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "height",
|
||||
"type": "integer",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "created_at",
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "now()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "conversation_read",
|
||||
"name": "user_id",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "conversation_read",
|
||||
"name": "conversation_id",
|
||||
"type": "uuid",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "conversation_read",
|
||||
"name": "last_read_message_id",
|
||||
"type": "uuid",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "conversation_read",
|
||||
"name": "updated_at",
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "now()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "message_reaction",
|
||||
"name": "message_id",
|
||||
"type": "uuid",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "message_reaction",
|
||||
"name": "user_id",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "message_reaction",
|
||||
"name": "emoji",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "message_reaction",
|
||||
"name": "created_at",
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "now()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "attachment_message_id_idx",
|
||||
"nameExplicit": true,
|
||||
"columns": [
|
||||
{
|
||||
"value": "message_id",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nullsFirst": false,
|
||||
"opclass": null
|
||||
}
|
||||
],
|
||||
"isUnique": false,
|
||||
"where": null,
|
||||
"with": "",
|
||||
"method": "btree",
|
||||
"entityType": "indexes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "attachment_uploader_id_idx",
|
||||
"nameExplicit": true,
|
||||
"columns": [
|
||||
{
|
||||
"value": "uploader_id",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nullsFirst": false,
|
||||
"opclass": null
|
||||
}
|
||||
],
|
||||
"isUnique": false,
|
||||
"where": null,
|
||||
"with": "",
|
||||
"method": "btree",
|
||||
"entityType": "indexes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "attachment_uploader_id_user_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"uploader_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "user",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "SET NULL",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "attachment_message_id_message_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"message_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "message",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "SET NULL",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "conversation_read",
|
||||
"name": "conversation_read_user_id_user_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"user_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "user",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "CASCADE",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "conversation_read",
|
||||
"name": "conversation_read_conversation_id_conversation_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"conversation_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "conversation",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "CASCADE",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "message_reaction",
|
||||
"name": "message_reaction_message_id_message_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"message_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "message",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "CASCADE",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "message_reaction",
|
||||
"name": "message_reaction_user_id_user_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"user_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "user",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "CASCADE",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "conversation_read",
|
||||
"name": "conversation_read_pkey",
|
||||
"columns": [
|
||||
"user_id",
|
||||
"conversation_id"
|
||||
],
|
||||
"nameExplicit": false,
|
||||
"entityType": "pks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "message_reaction",
|
||||
"name": "message_reaction_pkey",
|
||||
"columns": [
|
||||
"message_id",
|
||||
"user_id",
|
||||
"emoji"
|
||||
],
|
||||
"nameExplicit": false,
|
||||
"entityType": "pks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "attachment",
|
||||
"name": "attachment_pkey",
|
||||
"columns": [
|
||||
"id"
|
||||
],
|
||||
"nameExplicit": false,
|
||||
"entityType": "pks"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
CREATE TABLE "user_block" (
|
||||
"blocker_id" text,
|
||||
"blocked_id" text,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "user_block_pkey" PRIMARY KEY("blocker_id","blocked_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "realm_ban" (
|
||||
"realm_id" uuid,
|
||||
"user_id" text,
|
||||
"banned_by_id" text,
|
||||
"reason" text,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "realm_ban_pkey" PRIMARY KEY("realm_id","user_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX "user_block_blocked_id_idx" ON "user_block" ("blocked_id");--> statement-breakpoint
|
||||
ALTER TABLE "user_block" ADD CONSTRAINT "user_block_blocker_id_user_id_fkey" FOREIGN KEY ("blocker_id") REFERENCES "user"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "user_block" ADD CONSTRAINT "user_block_blocked_id_user_id_fkey" FOREIGN KEY ("blocked_id") REFERENCES "user"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "realm_ban" ADD CONSTRAINT "realm_ban_realm_id_realm_id_fkey" FOREIGN KEY ("realm_id") REFERENCES "realm"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "realm_ban" ADD CONSTRAINT "realm_ban_user_id_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE CASCADE;--> statement-breakpoint
|
||||
ALTER TABLE "realm_ban" ADD CONSTRAINT "realm_ban_banned_by_id_user_id_fkey" FOREIGN KEY ("banned_by_id") REFERENCES "user"("id") ON DELETE SET NULL;
|
||||
@@ -0,0 +1,483 @@
|
||||
{
|
||||
"type": "diff",
|
||||
"version": "10",
|
||||
"dialect": "postgres",
|
||||
"id": "8564cfc4-00fe-44c7-a0c7-513a03f6696a",
|
||||
"prevIds": [
|
||||
"97862caf-8fe6-4846-b50d-6852f29dfc94"
|
||||
],
|
||||
"footprints": [
|
||||
{
|
||||
"statementType": "create_table",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"user_block"
|
||||
],
|
||||
"writes": [
|
||||
"s|tbl|public.user_block",
|
||||
"n|tbl|public.user_block",
|
||||
"e|tbl|public.user_block",
|
||||
"n|rel|public.user_block",
|
||||
"n|type|public.user_block",
|
||||
"n|rel|public.user_block_pkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|sch|public"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_table",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"realm_ban"
|
||||
],
|
||||
"writes": [
|
||||
"s|tbl|public.realm_ban",
|
||||
"n|tbl|public.realm_ban",
|
||||
"e|tbl|public.realm_ban",
|
||||
"n|rel|public.realm_ban",
|
||||
"n|type|public.realm_ban",
|
||||
"n|rel|public.realm_ban_pkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|sch|public"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_index",
|
||||
"statementTarget": [
|
||||
"index",
|
||||
"public",
|
||||
"user_block",
|
||||
"user_block_blocked_id_idx"
|
||||
],
|
||||
"writes": [
|
||||
"s|idx|public.user_block_blocked_id_idx",
|
||||
"n|idx|public.user_block_blocked_id_idx",
|
||||
"e|idx|public.user_block_blocked_id_idx",
|
||||
"n|rel|public.user_block_blocked_id_idx"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.user_block",
|
||||
"n|sch|public",
|
||||
"n|col|public.user_block.blocked_id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"user_block"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.user_block.user_block_blocker_id_user_id_fkey",
|
||||
"n|fk|public.user_block.user_block_blocker_id_user_id_fkey",
|
||||
"e|fk|public.user_block.user_block_blocker_id_user_id_fkey",
|
||||
"n|con|public.user_block.user_block_blocker_id_user_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.user_block",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.user",
|
||||
"n|sch|public",
|
||||
"n|col|public.user_block.blocker_id",
|
||||
"n|col|public.user.id",
|
||||
"e|uniqueness|public.user.id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"user_block"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.user_block.user_block_blocked_id_user_id_fkey",
|
||||
"n|fk|public.user_block.user_block_blocked_id_user_id_fkey",
|
||||
"e|fk|public.user_block.user_block_blocked_id_user_id_fkey",
|
||||
"n|con|public.user_block.user_block_blocked_id_user_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.user_block",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.user",
|
||||
"n|sch|public",
|
||||
"n|col|public.user_block.blocked_id",
|
||||
"n|col|public.user.id",
|
||||
"e|uniqueness|public.user.id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"realm_ban"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.realm_ban.realm_ban_realm_id_realm_id_fkey",
|
||||
"n|fk|public.realm_ban.realm_ban_realm_id_realm_id_fkey",
|
||||
"e|fk|public.realm_ban.realm_ban_realm_id_realm_id_fkey",
|
||||
"n|con|public.realm_ban.realm_ban_realm_id_realm_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.realm_ban",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.realm",
|
||||
"n|sch|public",
|
||||
"n|col|public.realm_ban.realm_id",
|
||||
"n|col|public.realm.id",
|
||||
"e|uniqueness|public.realm.id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"realm_ban"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.realm_ban.realm_ban_user_id_user_id_fkey",
|
||||
"n|fk|public.realm_ban.realm_ban_user_id_user_id_fkey",
|
||||
"e|fk|public.realm_ban.realm_ban_user_id_user_id_fkey",
|
||||
"n|con|public.realm_ban.realm_ban_user_id_user_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.realm_ban",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.user",
|
||||
"n|sch|public",
|
||||
"n|col|public.realm_ban.user_id",
|
||||
"n|col|public.user.id",
|
||||
"e|uniqueness|public.user.id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"statementType": "create_fk",
|
||||
"statementTarget": [
|
||||
"table",
|
||||
"public",
|
||||
"realm_ban"
|
||||
],
|
||||
"writes": [
|
||||
"s|fk|public.realm_ban.realm_ban_banned_by_id_user_id_fkey",
|
||||
"n|fk|public.realm_ban.realm_ban_banned_by_id_user_id_fkey",
|
||||
"e|fk|public.realm_ban.realm_ban_banned_by_id_user_id_fkey",
|
||||
"n|con|public.realm_ban.realm_ban_banned_by_id_user_id_fkey"
|
||||
],
|
||||
"reads": [
|
||||
"n|tbl|public.realm_ban",
|
||||
"n|sch|public",
|
||||
"n|tbl|public.user",
|
||||
"n|sch|public",
|
||||
"n|col|public.realm_ban.banned_by_id",
|
||||
"n|col|public.user.id",
|
||||
"e|uniqueness|public.user.id"
|
||||
]
|
||||
}
|
||||
],
|
||||
"deltas": [
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"name": "user_block",
|
||||
"isRlsEnabled": false,
|
||||
"entityType": "tables"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"name": "realm_ban",
|
||||
"isRlsEnabled": false,
|
||||
"entityType": "tables"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "user_block",
|
||||
"name": "blocker_id",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "user_block",
|
||||
"name": "blocked_id",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "user_block",
|
||||
"name": "created_at",
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "now()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "realm_ban",
|
||||
"name": "realm_id",
|
||||
"type": "uuid",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "realm_ban",
|
||||
"name": "user_id",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "realm_ban",
|
||||
"name": "banned_by_id",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "realm_ban",
|
||||
"name": "reason",
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "realm_ban",
|
||||
"name": "created_at",
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "now()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"entityType": "columns"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "user_block",
|
||||
"name": "user_block_blocked_id_idx",
|
||||
"nameExplicit": true,
|
||||
"columns": [
|
||||
{
|
||||
"value": "blocked_id",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nullsFirst": false,
|
||||
"opclass": null
|
||||
}
|
||||
],
|
||||
"isUnique": false,
|
||||
"where": null,
|
||||
"with": "",
|
||||
"method": "btree",
|
||||
"entityType": "indexes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "user_block",
|
||||
"name": "user_block_blocker_id_user_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"blocker_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "user",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "CASCADE",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "user_block",
|
||||
"name": "user_block_blocked_id_user_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"blocked_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "user",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "CASCADE",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "realm_ban",
|
||||
"name": "realm_ban_realm_id_realm_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"realm_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "realm",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "CASCADE",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "realm_ban",
|
||||
"name": "realm_ban_user_id_user_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"user_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "user",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "CASCADE",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "realm_ban",
|
||||
"name": "realm_ban_banned_by_id_user_id_fkey",
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"banned_by_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "user",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "SET NULL",
|
||||
"entityType": "fks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "user_block",
|
||||
"name": "user_block_pkey",
|
||||
"columns": [
|
||||
"blocker_id",
|
||||
"blocked_id"
|
||||
],
|
||||
"nameExplicit": false,
|
||||
"entityType": "pks"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "create",
|
||||
"row": {
|
||||
"schema": "public",
|
||||
"table": "realm_ban",
|
||||
"name": "realm_ban_pkey",
|
||||
"columns": [
|
||||
"realm_id",
|
||||
"user_id"
|
||||
],
|
||||
"nameExplicit": false,
|
||||
"entityType": "pks"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user