organisaiton added

This commit is contained in:
Jun-te Kim 2026-03-20 14:05:00 +00:00
parent 3f8dd9bcd9
commit a6bb6f01d5
4 changed files with 6015 additions and 1 deletions

View file

@ -6,7 +6,7 @@ dotenv.config({ path: ".env.local" });
const isProduction = process.env.VERCEL_ENV === "production";
export default {
schema: "./src/app/db/schema/!(crm)/**/*.ts",
schema: "./src/app/db/schema/*",
out: "./src/app/db/migrations",
dialect: "postgresql",
dbCredentials: {

View file

@ -0,0 +1,38 @@
CREATE TABLE "organisation" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"created_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
"hubspot_company_id" text,
"company_name" text
);
--> statement-breakpoint
CREATE TABLE "team" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"team_name" text NOT NULL,
"org_id" uuid NOT NULL,
"created_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp (6) with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "team_members" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" bigint NOT NULL,
"team_id" uuid NOT NULL,
"created_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp (6) with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "team_portfolio_permissions" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"team_id" uuid NOT NULL,
"portfolio_id" bigint NOT NULL,
"role" "role" NOT NULL,
"created_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp (6) with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "team" ADD CONSTRAINT "team_org_id_organisation_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organisation"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "team_members" ADD CONSTRAINT "team_members_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "team_members" ADD CONSTRAINT "team_members_team_id_team_id_fk" FOREIGN KEY ("team_id") REFERENCES "public"."team"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "team_portfolio_permissions" ADD CONSTRAINT "team_portfolio_permissions_team_id_team_id_fk" FOREIGN KEY ("team_id") REFERENCES "public"."team"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "team_portfolio_permissions" ADD CONSTRAINT "team_portfolio_permissions_portfolio_id_portfolio_id_fk" FOREIGN KEY ("portfolio_id") REFERENCES "public"."portfolio"("id") ON DELETE no action ON UPDATE no action;

File diff suppressed because it is too large Load diff

View file

@ -1093,6 +1093,27 @@
"when": 1772637615885,
"tag": "0155_calm_hydra",
"breakpoints": true
},
{
"idx": 156,
"version": "7",
"when": 1774014986862,
"tag": "0156_high_ben_urich",
"breakpoints": true
},
{
"idx": 157,
"version": "7",
"when": 1774015131135,
"tag": "0157_mute_lockheed",
"breakpoints": true
},
{
"idx": 158,
"version": "7",
"when": 1774015417999,
"tag": "0158_light_shinko_yamashiro",
"breakpoints": true
}
]
}