feat: update workspace invite schema
This commit is contained in:
@@ -1,11 +1,16 @@
|
|||||||
CREATE TYPE "public"."invite_link_status" AS ENUM('active', 'inactive');--> statement-breakpoint
|
CREATE TYPE "public"."invite_link_status" AS ENUM('active', 'inactive');--> statement-breakpoint
|
||||||
CREATE TABLE IF NOT EXISTS "workspace_invite_links" (
|
CREATE TABLE IF NOT EXISTS "workspace_invite_links" (
|
||||||
"id" bigserial PRIMARY KEY NOT NULL,
|
"id" bigserial PRIMARY KEY NOT NULL,
|
||||||
|
"publicId" varchar(12) NOT NULL,
|
||||||
"workspaceId" bigint NOT NULL,
|
"workspaceId" bigint NOT NULL,
|
||||||
"code" varchar(12) NOT NULL,
|
"code" varchar(12) NOT NULL,
|
||||||
"status" "invite_link_status" DEFAULT 'active' NOT NULL,
|
"status" "invite_link_status" DEFAULT 'active' NOT NULL,
|
||||||
"expiresAt" timestamp,
|
"expiresAt" timestamp,
|
||||||
"createdAt" timestamp DEFAULT now() NOT NULL,
|
"createdAt" timestamp DEFAULT now() NOT NULL,
|
||||||
|
"createdBy" uuid,
|
||||||
|
"updatedAt" timestamp,
|
||||||
|
"updatedBy" uuid,
|
||||||
|
CONSTRAINT "workspace_invite_links_publicId_unique" UNIQUE("publicId"),
|
||||||
CONSTRAINT "workspace_invite_links_code_unique" UNIQUE("code")
|
CONSTRAINT "workspace_invite_links_code_unique" UNIQUE("code")
|
||||||
);
|
);
|
||||||
--> statement-breakpoint
|
--> statement-breakpoint
|
||||||
@@ -15,3 +20,15 @@ DO $$ BEGIN
|
|||||||
EXCEPTION
|
EXCEPTION
|
||||||
WHEN duplicate_object THEN null;
|
WHEN duplicate_object THEN null;
|
||||||
END $$;
|
END $$;
|
||||||
|
--> statement-breakpoint
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "workspace_invite_links" ADD CONSTRAINT "workspace_invite_links_createdBy_user_id_fk" FOREIGN KEY ("createdBy") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
|
--> statement-breakpoint
|
||||||
|
DO $$ BEGIN
|
||||||
|
ALTER TABLE "workspace_invite_links" ADD CONSTRAINT "workspace_invite_links_updatedBy_user_id_fk" FOREIGN KEY ("updatedBy") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
EXCEPTION
|
||||||
|
WHEN duplicate_object THEN null;
|
||||||
|
END $$;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"id": "1191cdae-d6ae-4120-959f-533391f11bdd",
|
"id": "50c69532-017e-43df-8969-7c811cbc1fda",
|
||||||
"prevId": "114f5db6-01fd-41b6-8125-e23f84424560",
|
"prevId": "114f5db6-01fd-41b6-8125-e23f84424560",
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"dialect": "postgresql",
|
"dialect": "postgresql",
|
||||||
@@ -2534,6 +2534,12 @@
|
|||||||
"primaryKey": true,
|
"primaryKey": true,
|
||||||
"notNull": true
|
"notNull": true
|
||||||
},
|
},
|
||||||
|
"publicId": {
|
||||||
|
"name": "publicId",
|
||||||
|
"type": "varchar(12)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
"workspaceId": {
|
"workspaceId": {
|
||||||
"name": "workspaceId",
|
"name": "workspaceId",
|
||||||
"type": "bigint",
|
"type": "bigint",
|
||||||
@@ -2566,6 +2572,24 @@
|
|||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": true,
|
"notNull": true,
|
||||||
"default": "now()"
|
"default": "now()"
|
||||||
|
},
|
||||||
|
"createdBy": {
|
||||||
|
"name": "createdBy",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"updatedAt": {
|
||||||
|
"name": "updatedAt",
|
||||||
|
"type": "timestamp",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"updatedBy": {
|
||||||
|
"name": "updatedBy",
|
||||||
|
"type": "uuid",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"indexes": {},
|
"indexes": {},
|
||||||
@@ -2582,10 +2606,43 @@
|
|||||||
],
|
],
|
||||||
"onDelete": "cascade",
|
"onDelete": "cascade",
|
||||||
"onUpdate": "no action"
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"workspace_invite_links_createdBy_user_id_fk": {
|
||||||
|
"name": "workspace_invite_links_createdBy_user_id_fk",
|
||||||
|
"tableFrom": "workspace_invite_links",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"createdBy"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "set null",
|
||||||
|
"onUpdate": "no action"
|
||||||
|
},
|
||||||
|
"workspace_invite_links_updatedBy_user_id_fk": {
|
||||||
|
"name": "workspace_invite_links_updatedBy_user_id_fk",
|
||||||
|
"tableFrom": "workspace_invite_links",
|
||||||
|
"tableTo": "user",
|
||||||
|
"columnsFrom": [
|
||||||
|
"updatedBy"
|
||||||
|
],
|
||||||
|
"columnsTo": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"onDelete": "set null",
|
||||||
|
"onUpdate": "no action"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"compositePrimaryKeys": {},
|
"compositePrimaryKeys": {},
|
||||||
"uniqueConstraints": {
|
"uniqueConstraints": {
|
||||||
|
"workspace_invite_links_publicId_unique": {
|
||||||
|
"name": "workspace_invite_links_publicId_unique",
|
||||||
|
"nullsNotDistinct": false,
|
||||||
|
"columns": [
|
||||||
|
"publicId"
|
||||||
|
]
|
||||||
|
},
|
||||||
"workspace_invite_links_code_unique": {
|
"workspace_invite_links_code_unique": {
|
||||||
"name": "workspace_invite_links_code_unique",
|
"name": "workspace_invite_links_code_unique",
|
||||||
"nullsNotDistinct": false,
|
"nullsNotDistinct": false,
|
||||||
@@ -110,8 +110,8 @@
|
|||||||
{
|
{
|
||||||
"idx": 15,
|
"idx": 15,
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"when": 1758637890146,
|
"when": 1758662398166,
|
||||||
"tag": "20250923143130_AddWorkspaceInviteLinks",
|
"tag": "20250923211958_AddWorkspaceInviteLinks",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user