update
CI / Lint, types, build, tests (push) Canceled after 0s
CI / Docker images build (push) Canceled after 0s

This commit is contained in:
olehhapuk
2026-12-03 10:53:09 +02:00
parent f8de87955b
commit 98b2e0ce4b
182 changed files with 24134 additions and 288 deletions
@@ -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"
}
}
]
}