Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CREATE TYPE "public"."connection_type" AS ENUM('neo4j', 'postgresql');--> statement-breakpoint
CREATE TYPE "public"."connection_visibility" AS ENUM('private', 'shared');--> statement-breakpoint
CREATE TYPE "public"."share_role" AS ENUM('viewer', 'editor');--> statement-breakpoint
CREATE TYPE "public"."sso_protocol" AS ENUM('oidc');--> statement-breakpoint
CREATE TYPE "public"."user_role" AS ENUM('admin', 'creator', 'reader');--> statement-breakpoint
CREATE TABLE "account" (
"userId" text NOT NULL,
Expand All @@ -20,20 +21,35 @@ CREATE TABLE "api_key" (
"userId" text NOT NULL,
"tenant_id" text DEFAULT 'default' NOT NULL,
"key_hash" text NOT NULL,
"key_prefix" text,
"name" text NOT NULL,
"last_used_at" timestamp,
"expires_at" timestamp,
"created_at" timestamp DEFAULT now(),
CONSTRAINT "api_key_key_hash_unique" UNIQUE("key_hash")
);
--> statement-breakpoint
CREATE TABLE "audit_log" (
"id" text PRIMARY KEY NOT NULL,
"tenant_id" text DEFAULT 'default' NOT NULL,
"user_id" text,
"action" text NOT NULL,
"resource_type" text,
"resource_id" text,
"details" jsonb,
"ip_address" text,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "connection" (
"id" text PRIMARY KEY NOT NULL,
"userId" text NOT NULL,
"tenant_id" text DEFAULT 'default' NOT NULL,
"name" text NOT NULL,
"type" "connection_type" NOT NULL,
"type" text NOT NULL,
"configEncrypted" text NOT NULL,
"allow_per_card_db" boolean DEFAULT true NOT NULL,
"visibility" "connection_visibility" DEFAULT 'private' NOT NULL,
"createdAt" timestamp DEFAULT now(),
"updatedAt" timestamp DEFAULT now()
);
Expand All @@ -54,7 +70,7 @@ CREATE TABLE "dashboard" (
"name" text NOT NULL,
"description" text,
"layoutJson" jsonb DEFAULT '{"version":2,"pages":[{"id":"page-1","title":"Page 1","widgets":[],"gridLayout":[]}]}'::jsonb,
"thumbnailJson" jsonb,
"version" integer DEFAULT 1 NOT NULL,
"isPublic" boolean DEFAULT false,
"createdAt" timestamp DEFAULT now(),
"updatedAt" timestamp DEFAULT now(),
Expand All @@ -67,19 +83,41 @@ CREATE TABLE "session" (
"expires" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "sso_provider" (
"id" text PRIMARY KEY NOT NULL,
"tenant_id" text DEFAULT 'default' NOT NULL,
"name" text NOT NULL,
"protocol" "sso_protocol" DEFAULT 'oidc' NOT NULL,
"issuer" text NOT NULL,
"client_id" text NOT NULL,
"client_secret_encrypted" text NOT NULL,
"scopes" text DEFAULT 'openid profile email' NOT NULL,
"claim_mappings" jsonb,
"auto_provision" boolean DEFAULT true NOT NULL,
"default_role" "user_role" DEFAULT 'creator' NOT NULL,
"enforce_sso" boolean DEFAULT false NOT NULL,
"enabled" boolean DEFAULT true NOT NULL,
"created_at" timestamp DEFAULT now(),
"updated_at" timestamp DEFAULT now(),
CONSTRAINT "sso_provider_tenant_issuer_unique" UNIQUE("tenant_id","issuer")
);
--> statement-breakpoint
CREATE TABLE "user" (
"id" text PRIMARY KEY NOT NULL,
"name" text,
"email" text,
"email" text NOT NULL,
"emailVerified" timestamp,
"image" text,
"passwordHash" text,
"role" "user_role" DEFAULT 'creator' NOT NULL,
"can_write" boolean DEFAULT true NOT NULL,
"force_password_change" boolean DEFAULT false NOT NULL,
"passwordChangedAt" timestamp,
"disabledAt" timestamp,
"lastLoginAt" timestamp,
"createdAt" timestamp DEFAULT now(),
CONSTRAINT "user_email_unique" UNIQUE("email")
"tenant_id" text DEFAULT 'default' NOT NULL,
CONSTRAINT "user_email_tenant_unique" UNIQUE("email","tenant_id")
);
--> statement-breakpoint
CREATE TABLE "verificationToken" (
Expand Down Expand Up @@ -108,6 +146,7 @@ CREATE TABLE "widget_template" (
--> statement-breakpoint
ALTER TABLE "account" ADD CONSTRAINT "account_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "api_key" ADD CONSTRAINT "api_key_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "audit_log" ADD CONSTRAINT "audit_log_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "connection" ADD CONSTRAINT "connection_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "dashboard_share" ADD CONSTRAINT "dashboard_share_dashboardId_dashboard_id_fk" FOREIGN KEY ("dashboardId") REFERENCES "public"."dashboard"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "dashboard_share" ADD CONSTRAINT "dashboard_share_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
Expand Down
1 change: 0 additions & 1 deletion app/drizzle/migrations/0001_rapid_iron_monger.sql

This file was deleted.

4 changes: 0 additions & 4 deletions app/drizzle/migrations/0002_redundant_night_nurse.sql

This file was deleted.

1 change: 0 additions & 1 deletion app/drizzle/migrations/0003_loving_centennial.sql

This file was deleted.

1 change: 0 additions & 1 deletion app/drizzle/migrations/0004_furry_scourge.sql

This file was deleted.

1 change: 0 additions & 1 deletion app/drizzle/migrations/0005_perfect_paibok.sql

This file was deleted.

19 changes: 0 additions & 19 deletions app/drizzle/migrations/0006_busy_champions.sql

This file was deleted.

13 changes: 0 additions & 13 deletions app/drizzle/migrations/0007_free_loners.sql

This file was deleted.

2 changes: 0 additions & 2 deletions app/drizzle/migrations/0008_lumpy_jubilee.sql

This file was deleted.

1 change: 0 additions & 1 deletion app/drizzle/migrations/0009_dazzling_stranger.sql

This file was deleted.

1 change: 0 additions & 1 deletion app/drizzle/migrations/0010_tiny_amphibian.sql

This file was deleted.

Loading
Loading