update
This commit is contained in:
@@ -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