diff --git a/app/drizzle/migrations/0000_wooden_zeigeist.sql b/app/drizzle/migrations/0000_cooing_greymalkin.sql similarity index 72% rename from app/drizzle/migrations/0000_wooden_zeigeist.sql rename to app/drizzle/migrations/0000_cooing_greymalkin.sql index 82e3ae8a..f402744d 100644 --- a/app/drizzle/migrations/0000_wooden_zeigeist.sql +++ b/app/drizzle/migrations/0000_cooing_greymalkin.sql @@ -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, @@ -20,6 +21,7 @@ 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, @@ -27,13 +29,27 @@ CREATE TABLE "api_key" ( 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() ); @@ -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(), @@ -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" ( @@ -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 diff --git a/app/drizzle/migrations/0001_rapid_iron_monger.sql b/app/drizzle/migrations/0001_rapid_iron_monger.sql deleted file mode 100644 index 2e24525b..00000000 --- a/app/drizzle/migrations/0001_rapid_iron_monger.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "user" ADD COLUMN "force_password_change" boolean DEFAULT false NOT NULL; \ No newline at end of file diff --git a/app/drizzle/migrations/0002_redundant_night_nurse.sql b/app/drizzle/migrations/0002_redundant_night_nurse.sql deleted file mode 100644 index f44b82a9..00000000 --- a/app/drizzle/migrations/0002_redundant_night_nurse.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE "user" DROP CONSTRAINT "user_email_unique";--> statement-breakpoint -ALTER TABLE "user" ALTER COLUMN "email" SET NOT NULL;--> statement-breakpoint -ALTER TABLE "user" ADD COLUMN "tenant_id" text DEFAULT 'default' NOT NULL;--> statement-breakpoint -ALTER TABLE "user" ADD CONSTRAINT "user_email_tenant_unique" UNIQUE("email","tenant_id"); \ No newline at end of file diff --git a/app/drizzle/migrations/0003_loving_centennial.sql b/app/drizzle/migrations/0003_loving_centennial.sql deleted file mode 100644 index d41794bc..00000000 --- a/app/drizzle/migrations/0003_loving_centennial.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "dashboard" ADD COLUMN "version" integer DEFAULT 1 NOT NULL; \ No newline at end of file diff --git a/app/drizzle/migrations/0004_furry_scourge.sql b/app/drizzle/migrations/0004_furry_scourge.sql deleted file mode 100644 index e7743a4f..00000000 --- a/app/drizzle/migrations/0004_furry_scourge.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "connection" ADD COLUMN "allow_per_card_db" boolean DEFAULT true NOT NULL; \ No newline at end of file diff --git a/app/drizzle/migrations/0005_perfect_paibok.sql b/app/drizzle/migrations/0005_perfect_paibok.sql deleted file mode 100644 index 742f44b8..00000000 --- a/app/drizzle/migrations/0005_perfect_paibok.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "user" ADD COLUMN "passwordChangedAt" timestamp; \ No newline at end of file diff --git a/app/drizzle/migrations/0006_busy_champions.sql b/app/drizzle/migrations/0006_busy_champions.sql deleted file mode 100644 index 4c4fc6ed..00000000 --- a/app/drizzle/migrations/0006_busy_champions.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TYPE "public"."sso_protocol" AS ENUM('oidc');--> 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") -); diff --git a/app/drizzle/migrations/0007_free_loners.sql b/app/drizzle/migrations/0007_free_loners.sql deleted file mode 100644 index 3bec3af8..00000000 --- a/app/drizzle/migrations/0007_free_loners.sql +++ /dev/null @@ -1,13 +0,0 @@ -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 -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; \ No newline at end of file diff --git a/app/drizzle/migrations/0008_lumpy_jubilee.sql b/app/drizzle/migrations/0008_lumpy_jubilee.sql deleted file mode 100644 index f8e8a888..00000000 --- a/app/drizzle/migrations/0008_lumpy_jubilee.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE TYPE "public"."connection_visibility" AS ENUM('private', 'shared');--> statement-breakpoint -ALTER TABLE "connection" ADD COLUMN "visibility" "connection_visibility" DEFAULT 'private' NOT NULL; \ No newline at end of file diff --git a/app/drizzle/migrations/0009_dazzling_stranger.sql b/app/drizzle/migrations/0009_dazzling_stranger.sql deleted file mode 100644 index 28c85c73..00000000 --- a/app/drizzle/migrations/0009_dazzling_stranger.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "api_key" ADD COLUMN "key_prefix" text; \ No newline at end of file diff --git a/app/drizzle/migrations/0010_tiny_amphibian.sql b/app/drizzle/migrations/0010_tiny_amphibian.sql deleted file mode 100644 index c3758497..00000000 --- a/app/drizzle/migrations/0010_tiny_amphibian.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "dashboard" DROP COLUMN "thumbnailJson"; \ No newline at end of file diff --git a/app/drizzle/migrations/meta/0000_snapshot.json b/app/drizzle/migrations/meta/0000_snapshot.json index cc8e21af..5f778fa0 100644 --- a/app/drizzle/migrations/meta/0000_snapshot.json +++ b/app/drizzle/migrations/meta/0000_snapshot.json @@ -1,6 +1,6 @@ { - "id": "0a1a88e9-a9f0-4c9a-933c-11e6e1214328", - "prevId": "17208288-2aaa-46a7-9c62-39817edc1550", + "id": "6fcf5265-8ae6-4dfe-b566-ce363bc415d4", + "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", "tables": { @@ -122,6 +122,12 @@ "primaryKey": false, "notNull": true }, + "key_prefix": { + "name": "key_prefix", + "type": "text", + "primaryKey": false, + "notNull": false + }, "name": { "name": "name", "type": "text", @@ -172,6 +178,85 @@ "checkConstraints": {}, "isRLSEnabled": false }, + "public.audit_log": { + "name": "audit_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'default'" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_type": { + "name": "resource_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "resource_id": { + "name": "resource_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "details": { + "name": "details", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "audit_log_user_id_user_id_fk": { + "name": "audit_log_user_id_user_id_fk", + "tableFrom": "audit_log", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, "public.connection": { "name": "connection", "schema": "", @@ -203,8 +288,7 @@ }, "type": { "name": "type", - "type": "connection_type", - "typeSchema": "public", + "type": "text", "primaryKey": false, "notNull": true }, @@ -214,6 +298,21 @@ "primaryKey": false, "notNull": true }, + "allow_per_card_db": { + "name": "allow_per_card_db", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "visibility": { + "name": "visibility", + "type": "connection_visibility", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'private'" + }, "createdAt": { "name": "createdAt", "type": "timestamp", @@ -360,11 +459,12 @@ "notNull": false, "default": "'{\"version\":2,\"pages\":[{\"id\":\"page-1\",\"title\":\"Page 1\",\"widgets\":[],\"gridLayout\":[]}]}'::jsonb" }, - "thumbnailJson": { - "name": "thumbnailJson", - "type": "jsonb", + "version": { + "name": "version", + "type": "integer", "primaryKey": false, - "notNull": false + "notNull": true, + "default": 1 }, "isPublic": { "name": "isPublic", @@ -462,6 +562,126 @@ "checkConstraints": {}, "isRLSEnabled": false }, + "public.sso_provider": { + "name": "sso_provider", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'default'" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "protocol": { + "name": "protocol", + "type": "sso_protocol", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'oidc'" + }, + "issuer": { + "name": "issuer", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "client_secret_encrypted": { + "name": "client_secret_encrypted", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'openid profile email'" + }, + "claim_mappings": { + "name": "claim_mappings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "auto_provision": { + "name": "auto_provision", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "default_role": { + "name": "default_role", + "type": "user_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'creator'" + }, + "enforce_sso": { + "name": "enforce_sso", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "sso_provider_tenant_issuer_unique": { + "name": "sso_provider_tenant_issuer_unique", + "nullsNotDistinct": false, + "columns": ["tenant_id", "issuer"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, "public.user": { "name": "user", "schema": "", @@ -482,7 +702,7 @@ "name": "email", "type": "text", "primaryKey": false, - "notNull": false + "notNull": true }, "emailVerified": { "name": "emailVerified", @@ -517,6 +737,19 @@ "notNull": true, "default": true }, + "force_password_change": { + "name": "force_password_change", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "passwordChangedAt": { + "name": "passwordChangedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, "disabledAt": { "name": "disabledAt", "type": "timestamp", @@ -535,16 +768,23 @@ "primaryKey": false, "notNull": false, "default": "now()" + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'default'" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", + "user_email_tenant_unique": { + "name": "user_email_tenant_unique", "nullsNotDistinct": false, - "columns": ["email"] + "columns": ["email", "tenant_id"] } }, "policies": {}, @@ -702,16 +942,21 @@ } }, "enums": { - "public.connection_type": { - "name": "connection_type", + "public.connection_visibility": { + "name": "connection_visibility", "schema": "public", - "values": ["neo4j", "postgresql"] + "values": ["private", "shared"] }, "public.share_role": { "name": "share_role", "schema": "public", "values": ["viewer", "editor"] }, + "public.sso_protocol": { + "name": "sso_protocol", + "schema": "public", + "values": ["oidc"] + }, "public.user_role": { "name": "user_role", "schema": "public", diff --git a/app/drizzle/migrations/meta/0001_snapshot.json b/app/drizzle/migrations/meta/0001_snapshot.json deleted file mode 100644 index 3e14da9e..00000000 --- a/app/drizzle/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,738 +0,0 @@ -{ - "id": "31365ff0-b6f5-4020-a787-0f053393c802", - "prevId": "0a1a88e9-a9f0-4c9a-933c-11e6e1214328", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "providerAccountId": { - "name": "providerAccountId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "token_type": { - "name": "token_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_state": { - "name": "session_state", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.api_key": { - "name": "api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "api_key_userId_user_id_fk": { - "name": "api_key_userId_user_id_fk", - "tableFrom": "api_key", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "api_key_key_hash_unique": { - "name": "api_key_key_hash_unique", - "nullsNotDistinct": false, - "columns": ["key_hash"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.connection": { - "name": "connection", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "connection_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "configEncrypted": { - "name": "configEncrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "connection_userId_user_id_fk": { - "name": "connection_userId_user_id_fk", - "tableFrom": "connection", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard_share": { - "name": "dashboard_share", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "dashboardId": { - "name": "dashboardId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "role": { - "name": "role", - "type": "share_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_share_dashboardId_dashboard_id_fk": { - "name": "dashboard_share_dashboardId_dashboard_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "dashboard", - "columnsFrom": ["dashboardId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_share_userId_user_id_fk": { - "name": "dashboard_share_userId_user_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "layoutJson": { - "name": "layoutJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{\"version\":2,\"pages\":[{\"id\":\"page-1\",\"title\":\"Page 1\",\"widgets\":[],\"gridLayout\":[]}]}'::jsonb" - }, - "thumbnailJson": { - "name": "thumbnailJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "isPublic": { - "name": "isPublic", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_by": { - "name": "updated_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_userId_user_id_fk": { - "name": "dashboard_userId_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_updated_by_user_id_fk": { - "name": "dashboard_updated_by_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["updated_by"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "passwordHash": { - "name": "passwordHash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "can_write": { - "name": "can_write", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "force_password_change": { - "name": "force_password_change", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "disabledAt": { - "name": "disabledAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "lastLoginAt": { - "name": "lastLoginAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": ["email"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verificationToken": { - "name": "verificationToken", - "schema": "", - "columns": { - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.widget_template": { - "name": "widget_template", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "chartType": { - "name": "chartType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectorType": { - "name": "connectorType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectionId": { - "name": "connectionId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "query": { - "name": "query", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "params": { - "name": "params", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "settings": { - "name": "settings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "previewImageUrl": { - "name": "previewImageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "createdBy": { - "name": "createdBy", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "widget_template_createdBy_user_id_fk": { - "name": "widget_template_createdBy_user_id_fk", - "tableFrom": "widget_template", - "tableTo": "user", - "columnsFrom": ["createdBy"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.connection_type": { - "name": "connection_type", - "schema": "public", - "values": ["neo4j", "postgresql"] - }, - "public.share_role": { - "name": "share_role", - "schema": "public", - "values": ["viewer", "editor"] - }, - "public.user_role": { - "name": "user_role", - "schema": "public", - "values": ["admin", "creator", "reader"] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/app/drizzle/migrations/meta/0002_snapshot.json b/app/drizzle/migrations/meta/0002_snapshot.json deleted file mode 100644 index 2721df99..00000000 --- a/app/drizzle/migrations/meta/0002_snapshot.json +++ /dev/null @@ -1,745 +0,0 @@ -{ - "id": "632932b5-b9f1-47b8-b8e6-f4f7aeaad698", - "prevId": "31365ff0-b6f5-4020-a787-0f053393c802", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "providerAccountId": { - "name": "providerAccountId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "token_type": { - "name": "token_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_state": { - "name": "session_state", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.api_key": { - "name": "api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "api_key_userId_user_id_fk": { - "name": "api_key_userId_user_id_fk", - "tableFrom": "api_key", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "api_key_key_hash_unique": { - "name": "api_key_key_hash_unique", - "nullsNotDistinct": false, - "columns": ["key_hash"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.connection": { - "name": "connection", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "connection_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "configEncrypted": { - "name": "configEncrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "connection_userId_user_id_fk": { - "name": "connection_userId_user_id_fk", - "tableFrom": "connection", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard_share": { - "name": "dashboard_share", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "dashboardId": { - "name": "dashboardId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "role": { - "name": "role", - "type": "share_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_share_dashboardId_dashboard_id_fk": { - "name": "dashboard_share_dashboardId_dashboard_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "dashboard", - "columnsFrom": ["dashboardId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_share_userId_user_id_fk": { - "name": "dashboard_share_userId_user_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "layoutJson": { - "name": "layoutJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{\"version\":2,\"pages\":[{\"id\":\"page-1\",\"title\":\"Page 1\",\"widgets\":[],\"gridLayout\":[]}]}'::jsonb" - }, - "thumbnailJson": { - "name": "thumbnailJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "isPublic": { - "name": "isPublic", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_by": { - "name": "updated_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_userId_user_id_fk": { - "name": "dashboard_userId_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_updated_by_user_id_fk": { - "name": "dashboard_updated_by_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["updated_by"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "passwordHash": { - "name": "passwordHash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "can_write": { - "name": "can_write", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "force_password_change": { - "name": "force_password_change", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "disabledAt": { - "name": "disabledAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "lastLoginAt": { - "name": "lastLoginAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_tenant_unique": { - "name": "user_email_tenant_unique", - "nullsNotDistinct": false, - "columns": ["email", "tenant_id"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verificationToken": { - "name": "verificationToken", - "schema": "", - "columns": { - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.widget_template": { - "name": "widget_template", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "chartType": { - "name": "chartType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectorType": { - "name": "connectorType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectionId": { - "name": "connectionId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "query": { - "name": "query", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "params": { - "name": "params", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "settings": { - "name": "settings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "previewImageUrl": { - "name": "previewImageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "createdBy": { - "name": "createdBy", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "widget_template_createdBy_user_id_fk": { - "name": "widget_template_createdBy_user_id_fk", - "tableFrom": "widget_template", - "tableTo": "user", - "columnsFrom": ["createdBy"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.connection_type": { - "name": "connection_type", - "schema": "public", - "values": ["neo4j", "postgresql"] - }, - "public.share_role": { - "name": "share_role", - "schema": "public", - "values": ["viewer", "editor"] - }, - "public.user_role": { - "name": "user_role", - "schema": "public", - "values": ["admin", "creator", "reader"] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/app/drizzle/migrations/meta/0003_snapshot.json b/app/drizzle/migrations/meta/0003_snapshot.json deleted file mode 100644 index a4b52350..00000000 --- a/app/drizzle/migrations/meta/0003_snapshot.json +++ /dev/null @@ -1,752 +0,0 @@ -{ - "id": "f3e72f09-0731-4ceb-95f6-ce27e251c2d6", - "prevId": "632932b5-b9f1-47b8-b8e6-f4f7aeaad698", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "providerAccountId": { - "name": "providerAccountId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "token_type": { - "name": "token_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_state": { - "name": "session_state", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.api_key": { - "name": "api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "api_key_userId_user_id_fk": { - "name": "api_key_userId_user_id_fk", - "tableFrom": "api_key", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "api_key_key_hash_unique": { - "name": "api_key_key_hash_unique", - "nullsNotDistinct": false, - "columns": ["key_hash"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.connection": { - "name": "connection", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "connection_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "configEncrypted": { - "name": "configEncrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "connection_userId_user_id_fk": { - "name": "connection_userId_user_id_fk", - "tableFrom": "connection", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard_share": { - "name": "dashboard_share", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "dashboardId": { - "name": "dashboardId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "role": { - "name": "role", - "type": "share_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_share_dashboardId_dashboard_id_fk": { - "name": "dashboard_share_dashboardId_dashboard_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "dashboard", - "columnsFrom": ["dashboardId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_share_userId_user_id_fk": { - "name": "dashboard_share_userId_user_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "layoutJson": { - "name": "layoutJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{\"version\":2,\"pages\":[{\"id\":\"page-1\",\"title\":\"Page 1\",\"widgets\":[],\"gridLayout\":[]}]}'::jsonb" - }, - "thumbnailJson": { - "name": "thumbnailJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "isPublic": { - "name": "isPublic", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_by": { - "name": "updated_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_userId_user_id_fk": { - "name": "dashboard_userId_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_updated_by_user_id_fk": { - "name": "dashboard_updated_by_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["updated_by"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "passwordHash": { - "name": "passwordHash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "can_write": { - "name": "can_write", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "force_password_change": { - "name": "force_password_change", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "disabledAt": { - "name": "disabledAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "lastLoginAt": { - "name": "lastLoginAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_tenant_unique": { - "name": "user_email_tenant_unique", - "nullsNotDistinct": false, - "columns": ["email", "tenant_id"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verificationToken": { - "name": "verificationToken", - "schema": "", - "columns": { - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.widget_template": { - "name": "widget_template", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "chartType": { - "name": "chartType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectorType": { - "name": "connectorType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectionId": { - "name": "connectionId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "query": { - "name": "query", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "params": { - "name": "params", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "settings": { - "name": "settings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "previewImageUrl": { - "name": "previewImageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "createdBy": { - "name": "createdBy", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "widget_template_createdBy_user_id_fk": { - "name": "widget_template_createdBy_user_id_fk", - "tableFrom": "widget_template", - "tableTo": "user", - "columnsFrom": ["createdBy"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.connection_type": { - "name": "connection_type", - "schema": "public", - "values": ["neo4j", "postgresql"] - }, - "public.share_role": { - "name": "share_role", - "schema": "public", - "values": ["viewer", "editor"] - }, - "public.user_role": { - "name": "user_role", - "schema": "public", - "values": ["admin", "creator", "reader"] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/app/drizzle/migrations/meta/0004_snapshot.json b/app/drizzle/migrations/meta/0004_snapshot.json deleted file mode 100644 index e6fa4f71..00000000 --- a/app/drizzle/migrations/meta/0004_snapshot.json +++ /dev/null @@ -1,759 +0,0 @@ -{ - "id": "7b9937b8-824a-4bcd-83ff-97c399ff8096", - "prevId": "f3e72f09-0731-4ceb-95f6-ce27e251c2d6", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "providerAccountId": { - "name": "providerAccountId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "token_type": { - "name": "token_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_state": { - "name": "session_state", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.api_key": { - "name": "api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "api_key_userId_user_id_fk": { - "name": "api_key_userId_user_id_fk", - "tableFrom": "api_key", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "api_key_key_hash_unique": { - "name": "api_key_key_hash_unique", - "nullsNotDistinct": false, - "columns": ["key_hash"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.connection": { - "name": "connection", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "connection_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "configEncrypted": { - "name": "configEncrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "allow_per_card_db": { - "name": "allow_per_card_db", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "connection_userId_user_id_fk": { - "name": "connection_userId_user_id_fk", - "tableFrom": "connection", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard_share": { - "name": "dashboard_share", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "dashboardId": { - "name": "dashboardId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "role": { - "name": "role", - "type": "share_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_share_dashboardId_dashboard_id_fk": { - "name": "dashboard_share_dashboardId_dashboard_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "dashboard", - "columnsFrom": ["dashboardId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_share_userId_user_id_fk": { - "name": "dashboard_share_userId_user_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "layoutJson": { - "name": "layoutJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{\"version\":2,\"pages\":[{\"id\":\"page-1\",\"title\":\"Page 1\",\"widgets\":[],\"gridLayout\":[]}]}'::jsonb" - }, - "thumbnailJson": { - "name": "thumbnailJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "isPublic": { - "name": "isPublic", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_by": { - "name": "updated_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_userId_user_id_fk": { - "name": "dashboard_userId_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_updated_by_user_id_fk": { - "name": "dashboard_updated_by_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["updated_by"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "passwordHash": { - "name": "passwordHash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "can_write": { - "name": "can_write", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "force_password_change": { - "name": "force_password_change", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "disabledAt": { - "name": "disabledAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "lastLoginAt": { - "name": "lastLoginAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_tenant_unique": { - "name": "user_email_tenant_unique", - "nullsNotDistinct": false, - "columns": ["email", "tenant_id"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verificationToken": { - "name": "verificationToken", - "schema": "", - "columns": { - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.widget_template": { - "name": "widget_template", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "chartType": { - "name": "chartType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectorType": { - "name": "connectorType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectionId": { - "name": "connectionId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "query": { - "name": "query", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "params": { - "name": "params", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "settings": { - "name": "settings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "previewImageUrl": { - "name": "previewImageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "createdBy": { - "name": "createdBy", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "widget_template_createdBy_user_id_fk": { - "name": "widget_template_createdBy_user_id_fk", - "tableFrom": "widget_template", - "tableTo": "user", - "columnsFrom": ["createdBy"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.connection_type": { - "name": "connection_type", - "schema": "public", - "values": ["neo4j", "postgresql"] - }, - "public.share_role": { - "name": "share_role", - "schema": "public", - "values": ["viewer", "editor"] - }, - "public.user_role": { - "name": "user_role", - "schema": "public", - "values": ["admin", "creator", "reader"] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/app/drizzle/migrations/meta/0005_snapshot.json b/app/drizzle/migrations/meta/0005_snapshot.json deleted file mode 100644 index c61bcaec..00000000 --- a/app/drizzle/migrations/meta/0005_snapshot.json +++ /dev/null @@ -1,765 +0,0 @@ -{ - "id": "d5bdb422-ab74-449d-8e95-0342205ac8f3", - "prevId": "7b9937b8-824a-4bcd-83ff-97c399ff8096", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "providerAccountId": { - "name": "providerAccountId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "token_type": { - "name": "token_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_state": { - "name": "session_state", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.api_key": { - "name": "api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "api_key_userId_user_id_fk": { - "name": "api_key_userId_user_id_fk", - "tableFrom": "api_key", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "api_key_key_hash_unique": { - "name": "api_key_key_hash_unique", - "nullsNotDistinct": false, - "columns": ["key_hash"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.connection": { - "name": "connection", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "connection_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "configEncrypted": { - "name": "configEncrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "allow_per_card_db": { - "name": "allow_per_card_db", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "connection_userId_user_id_fk": { - "name": "connection_userId_user_id_fk", - "tableFrom": "connection", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard_share": { - "name": "dashboard_share", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "dashboardId": { - "name": "dashboardId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "role": { - "name": "role", - "type": "share_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_share_dashboardId_dashboard_id_fk": { - "name": "dashboard_share_dashboardId_dashboard_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "dashboard", - "columnsFrom": ["dashboardId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_share_userId_user_id_fk": { - "name": "dashboard_share_userId_user_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "layoutJson": { - "name": "layoutJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{\"version\":2,\"pages\":[{\"id\":\"page-1\",\"title\":\"Page 1\",\"widgets\":[],\"gridLayout\":[]}]}'::jsonb" - }, - "thumbnailJson": { - "name": "thumbnailJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "isPublic": { - "name": "isPublic", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_by": { - "name": "updated_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_userId_user_id_fk": { - "name": "dashboard_userId_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_updated_by_user_id_fk": { - "name": "dashboard_updated_by_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["updated_by"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "passwordHash": { - "name": "passwordHash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "can_write": { - "name": "can_write", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "force_password_change": { - "name": "force_password_change", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passwordChangedAt": { - "name": "passwordChangedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "disabledAt": { - "name": "disabledAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "lastLoginAt": { - "name": "lastLoginAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_tenant_unique": { - "name": "user_email_tenant_unique", - "nullsNotDistinct": false, - "columns": ["email", "tenant_id"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verificationToken": { - "name": "verificationToken", - "schema": "", - "columns": { - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.widget_template": { - "name": "widget_template", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "chartType": { - "name": "chartType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectorType": { - "name": "connectorType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectionId": { - "name": "connectionId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "query": { - "name": "query", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "params": { - "name": "params", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "settings": { - "name": "settings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "previewImageUrl": { - "name": "previewImageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "createdBy": { - "name": "createdBy", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "widget_template_createdBy_user_id_fk": { - "name": "widget_template_createdBy_user_id_fk", - "tableFrom": "widget_template", - "tableTo": "user", - "columnsFrom": ["createdBy"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.connection_type": { - "name": "connection_type", - "schema": "public", - "values": ["neo4j", "postgresql"] - }, - "public.share_role": { - "name": "share_role", - "schema": "public", - "values": ["viewer", "editor"] - }, - "public.user_role": { - "name": "user_role", - "schema": "public", - "values": ["admin", "creator", "reader"] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/app/drizzle/migrations/meta/0006_snapshot.json b/app/drizzle/migrations/meta/0006_snapshot.json deleted file mode 100644 index 5eeb0ae8..00000000 --- a/app/drizzle/migrations/meta/0006_snapshot.json +++ /dev/null @@ -1,890 +0,0 @@ -{ - "id": "f3590c20-fe02-4b05-b036-0baf5b882309", - "prevId": "d5bdb422-ab74-449d-8e95-0342205ac8f3", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "providerAccountId": { - "name": "providerAccountId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "token_type": { - "name": "token_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_state": { - "name": "session_state", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.api_key": { - "name": "api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "api_key_userId_user_id_fk": { - "name": "api_key_userId_user_id_fk", - "tableFrom": "api_key", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "api_key_key_hash_unique": { - "name": "api_key_key_hash_unique", - "nullsNotDistinct": false, - "columns": ["key_hash"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.connection": { - "name": "connection", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "connection_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "configEncrypted": { - "name": "configEncrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "allow_per_card_db": { - "name": "allow_per_card_db", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "connection_userId_user_id_fk": { - "name": "connection_userId_user_id_fk", - "tableFrom": "connection", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard_share": { - "name": "dashboard_share", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "dashboardId": { - "name": "dashboardId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "role": { - "name": "role", - "type": "share_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_share_dashboardId_dashboard_id_fk": { - "name": "dashboard_share_dashboardId_dashboard_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "dashboard", - "columnsFrom": ["dashboardId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_share_userId_user_id_fk": { - "name": "dashboard_share_userId_user_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "layoutJson": { - "name": "layoutJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{\"version\":2,\"pages\":[{\"id\":\"page-1\",\"title\":\"Page 1\",\"widgets\":[],\"gridLayout\":[]}]}'::jsonb" - }, - "thumbnailJson": { - "name": "thumbnailJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "isPublic": { - "name": "isPublic", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_by": { - "name": "updated_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_userId_user_id_fk": { - "name": "dashboard_userId_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_updated_by_user_id_fk": { - "name": "dashboard_updated_by_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["updated_by"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sso_provider": { - "name": "sso_provider", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "protocol": { - "name": "protocol", - "type": "sso_protocol", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'oidc'" - }, - "issuer": { - "name": "issuer", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "client_id": { - "name": "client_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "client_secret_encrypted": { - "name": "client_secret_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scopes": { - "name": "scopes", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'openid profile email'" - }, - "claim_mappings": { - "name": "claim_mappings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "auto_provision": { - "name": "auto_provision", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "default_role": { - "name": "default_role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "enforce_sso": { - "name": "enforce_sso", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sso_provider_tenant_issuer_unique": { - "name": "sso_provider_tenant_issuer_unique", - "nullsNotDistinct": false, - "columns": ["tenant_id", "issuer"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "passwordHash": { - "name": "passwordHash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "can_write": { - "name": "can_write", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "force_password_change": { - "name": "force_password_change", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passwordChangedAt": { - "name": "passwordChangedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "disabledAt": { - "name": "disabledAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "lastLoginAt": { - "name": "lastLoginAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_tenant_unique": { - "name": "user_email_tenant_unique", - "nullsNotDistinct": false, - "columns": ["email", "tenant_id"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verificationToken": { - "name": "verificationToken", - "schema": "", - "columns": { - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.widget_template": { - "name": "widget_template", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "chartType": { - "name": "chartType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectorType": { - "name": "connectorType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectionId": { - "name": "connectionId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "query": { - "name": "query", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "params": { - "name": "params", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "settings": { - "name": "settings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "previewImageUrl": { - "name": "previewImageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "createdBy": { - "name": "createdBy", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "widget_template_createdBy_user_id_fk": { - "name": "widget_template_createdBy_user_id_fk", - "tableFrom": "widget_template", - "tableTo": "user", - "columnsFrom": ["createdBy"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.connection_type": { - "name": "connection_type", - "schema": "public", - "values": ["neo4j", "postgresql"] - }, - "public.share_role": { - "name": "share_role", - "schema": "public", - "values": ["viewer", "editor"] - }, - "public.sso_protocol": { - "name": "sso_protocol", - "schema": "public", - "values": ["oidc"] - }, - "public.user_role": { - "name": "user_role", - "schema": "public", - "values": ["admin", "creator", "reader"] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/app/drizzle/migrations/meta/0007_snapshot.json b/app/drizzle/migrations/meta/0007_snapshot.json deleted file mode 100644 index 106e2c81..00000000 --- a/app/drizzle/migrations/meta/0007_snapshot.json +++ /dev/null @@ -1,969 +0,0 @@ -{ - "id": "34edd0e6-71f6-4597-ae67-e79f8365a833", - "prevId": "f3590c20-fe02-4b05-b036-0baf5b882309", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "providerAccountId": { - "name": "providerAccountId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "token_type": { - "name": "token_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_state": { - "name": "session_state", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.api_key": { - "name": "api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "api_key_userId_user_id_fk": { - "name": "api_key_userId_user_id_fk", - "tableFrom": "api_key", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "api_key_key_hash_unique": { - "name": "api_key_key_hash_unique", - "nullsNotDistinct": false, - "columns": ["key_hash"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.audit_log": { - "name": "audit_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "resource_type": { - "name": "resource_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "resource_id": { - "name": "resource_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_user_id_user_id_fk": { - "name": "audit_log_user_id_user_id_fk", - "tableFrom": "audit_log", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.connection": { - "name": "connection", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "connection_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "configEncrypted": { - "name": "configEncrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "allow_per_card_db": { - "name": "allow_per_card_db", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "connection_userId_user_id_fk": { - "name": "connection_userId_user_id_fk", - "tableFrom": "connection", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard_share": { - "name": "dashboard_share", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "dashboardId": { - "name": "dashboardId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "role": { - "name": "role", - "type": "share_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_share_dashboardId_dashboard_id_fk": { - "name": "dashboard_share_dashboardId_dashboard_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "dashboard", - "columnsFrom": ["dashboardId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_share_userId_user_id_fk": { - "name": "dashboard_share_userId_user_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "layoutJson": { - "name": "layoutJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{\"version\":2,\"pages\":[{\"id\":\"page-1\",\"title\":\"Page 1\",\"widgets\":[],\"gridLayout\":[]}]}'::jsonb" - }, - "thumbnailJson": { - "name": "thumbnailJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "isPublic": { - "name": "isPublic", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_by": { - "name": "updated_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_userId_user_id_fk": { - "name": "dashboard_userId_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_updated_by_user_id_fk": { - "name": "dashboard_updated_by_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["updated_by"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sso_provider": { - "name": "sso_provider", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "protocol": { - "name": "protocol", - "type": "sso_protocol", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'oidc'" - }, - "issuer": { - "name": "issuer", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "client_id": { - "name": "client_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "client_secret_encrypted": { - "name": "client_secret_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scopes": { - "name": "scopes", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'openid profile email'" - }, - "claim_mappings": { - "name": "claim_mappings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "auto_provision": { - "name": "auto_provision", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "default_role": { - "name": "default_role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "enforce_sso": { - "name": "enforce_sso", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sso_provider_tenant_issuer_unique": { - "name": "sso_provider_tenant_issuer_unique", - "nullsNotDistinct": false, - "columns": ["tenant_id", "issuer"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "passwordHash": { - "name": "passwordHash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "can_write": { - "name": "can_write", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "force_password_change": { - "name": "force_password_change", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passwordChangedAt": { - "name": "passwordChangedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "disabledAt": { - "name": "disabledAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "lastLoginAt": { - "name": "lastLoginAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_tenant_unique": { - "name": "user_email_tenant_unique", - "nullsNotDistinct": false, - "columns": ["email", "tenant_id"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verificationToken": { - "name": "verificationToken", - "schema": "", - "columns": { - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.widget_template": { - "name": "widget_template", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "chartType": { - "name": "chartType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectorType": { - "name": "connectorType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectionId": { - "name": "connectionId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "query": { - "name": "query", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "params": { - "name": "params", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "settings": { - "name": "settings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "previewImageUrl": { - "name": "previewImageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "createdBy": { - "name": "createdBy", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "widget_template_createdBy_user_id_fk": { - "name": "widget_template_createdBy_user_id_fk", - "tableFrom": "widget_template", - "tableTo": "user", - "columnsFrom": ["createdBy"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.connection_type": { - "name": "connection_type", - "schema": "public", - "values": ["neo4j", "postgresql"] - }, - "public.share_role": { - "name": "share_role", - "schema": "public", - "values": ["viewer", "editor"] - }, - "public.sso_protocol": { - "name": "sso_protocol", - "schema": "public", - "values": ["oidc"] - }, - "public.user_role": { - "name": "user_role", - "schema": "public", - "values": ["admin", "creator", "reader"] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/app/drizzle/migrations/meta/0008_snapshot.json b/app/drizzle/migrations/meta/0008_snapshot.json deleted file mode 100644 index 69ac01e5..00000000 --- a/app/drizzle/migrations/meta/0008_snapshot.json +++ /dev/null @@ -1,982 +0,0 @@ -{ - "id": "5ec3aba2-98b3-4832-a130-965cbfd71d54", - "prevId": "34edd0e6-71f6-4597-ae67-e79f8365a833", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "providerAccountId": { - "name": "providerAccountId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "token_type": { - "name": "token_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_state": { - "name": "session_state", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.api_key": { - "name": "api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "api_key_userId_user_id_fk": { - "name": "api_key_userId_user_id_fk", - "tableFrom": "api_key", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "api_key_key_hash_unique": { - "name": "api_key_key_hash_unique", - "nullsNotDistinct": false, - "columns": ["key_hash"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.audit_log": { - "name": "audit_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "resource_type": { - "name": "resource_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "resource_id": { - "name": "resource_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_user_id_user_id_fk": { - "name": "audit_log_user_id_user_id_fk", - "tableFrom": "audit_log", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.connection": { - "name": "connection", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "connection_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "configEncrypted": { - "name": "configEncrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "allow_per_card_db": { - "name": "allow_per_card_db", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "visibility": { - "name": "visibility", - "type": "connection_visibility", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "connection_userId_user_id_fk": { - "name": "connection_userId_user_id_fk", - "tableFrom": "connection", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard_share": { - "name": "dashboard_share", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "dashboardId": { - "name": "dashboardId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "role": { - "name": "role", - "type": "share_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_share_dashboardId_dashboard_id_fk": { - "name": "dashboard_share_dashboardId_dashboard_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "dashboard", - "columnsFrom": ["dashboardId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_share_userId_user_id_fk": { - "name": "dashboard_share_userId_user_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "layoutJson": { - "name": "layoutJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{\"version\":2,\"pages\":[{\"id\":\"page-1\",\"title\":\"Page 1\",\"widgets\":[],\"gridLayout\":[]}]}'::jsonb" - }, - "thumbnailJson": { - "name": "thumbnailJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "isPublic": { - "name": "isPublic", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_by": { - "name": "updated_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_userId_user_id_fk": { - "name": "dashboard_userId_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_updated_by_user_id_fk": { - "name": "dashboard_updated_by_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["updated_by"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sso_provider": { - "name": "sso_provider", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "protocol": { - "name": "protocol", - "type": "sso_protocol", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'oidc'" - }, - "issuer": { - "name": "issuer", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "client_id": { - "name": "client_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "client_secret_encrypted": { - "name": "client_secret_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scopes": { - "name": "scopes", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'openid profile email'" - }, - "claim_mappings": { - "name": "claim_mappings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "auto_provision": { - "name": "auto_provision", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "default_role": { - "name": "default_role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "enforce_sso": { - "name": "enforce_sso", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sso_provider_tenant_issuer_unique": { - "name": "sso_provider_tenant_issuer_unique", - "nullsNotDistinct": false, - "columns": ["tenant_id", "issuer"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "passwordHash": { - "name": "passwordHash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "can_write": { - "name": "can_write", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "force_password_change": { - "name": "force_password_change", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passwordChangedAt": { - "name": "passwordChangedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "disabledAt": { - "name": "disabledAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "lastLoginAt": { - "name": "lastLoginAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_tenant_unique": { - "name": "user_email_tenant_unique", - "nullsNotDistinct": false, - "columns": ["email", "tenant_id"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verificationToken": { - "name": "verificationToken", - "schema": "", - "columns": { - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.widget_template": { - "name": "widget_template", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "chartType": { - "name": "chartType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectorType": { - "name": "connectorType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectionId": { - "name": "connectionId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "query": { - "name": "query", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "params": { - "name": "params", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "settings": { - "name": "settings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "previewImageUrl": { - "name": "previewImageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "createdBy": { - "name": "createdBy", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "widget_template_createdBy_user_id_fk": { - "name": "widget_template_createdBy_user_id_fk", - "tableFrom": "widget_template", - "tableTo": "user", - "columnsFrom": ["createdBy"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.connection_type": { - "name": "connection_type", - "schema": "public", - "values": ["neo4j", "postgresql"] - }, - "public.connection_visibility": { - "name": "connection_visibility", - "schema": "public", - "values": ["private", "shared"] - }, - "public.share_role": { - "name": "share_role", - "schema": "public", - "values": ["viewer", "editor"] - }, - "public.sso_protocol": { - "name": "sso_protocol", - "schema": "public", - "values": ["oidc"] - }, - "public.user_role": { - "name": "user_role", - "schema": "public", - "values": ["admin", "creator", "reader"] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/app/drizzle/migrations/meta/0009_snapshot.json b/app/drizzle/migrations/meta/0009_snapshot.json deleted file mode 100644 index e5644e79..00000000 --- a/app/drizzle/migrations/meta/0009_snapshot.json +++ /dev/null @@ -1,988 +0,0 @@ -{ - "id": "aa735688-7be4-4a2b-955a-cabed6352a06", - "prevId": "5ec3aba2-98b3-4832-a130-965cbfd71d54", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "providerAccountId": { - "name": "providerAccountId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "token_type": { - "name": "token_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_state": { - "name": "session_state", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.api_key": { - "name": "api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key_prefix": { - "name": "key_prefix", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "api_key_userId_user_id_fk": { - "name": "api_key_userId_user_id_fk", - "tableFrom": "api_key", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "api_key_key_hash_unique": { - "name": "api_key_key_hash_unique", - "nullsNotDistinct": false, - "columns": ["key_hash"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.audit_log": { - "name": "audit_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "resource_type": { - "name": "resource_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "resource_id": { - "name": "resource_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_user_id_user_id_fk": { - "name": "audit_log_user_id_user_id_fk", - "tableFrom": "audit_log", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.connection": { - "name": "connection", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "connection_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "configEncrypted": { - "name": "configEncrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "allow_per_card_db": { - "name": "allow_per_card_db", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "visibility": { - "name": "visibility", - "type": "connection_visibility", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "connection_userId_user_id_fk": { - "name": "connection_userId_user_id_fk", - "tableFrom": "connection", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard_share": { - "name": "dashboard_share", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "dashboardId": { - "name": "dashboardId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "role": { - "name": "role", - "type": "share_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_share_dashboardId_dashboard_id_fk": { - "name": "dashboard_share_dashboardId_dashboard_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "dashboard", - "columnsFrom": ["dashboardId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_share_userId_user_id_fk": { - "name": "dashboard_share_userId_user_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "layoutJson": { - "name": "layoutJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{\"version\":2,\"pages\":[{\"id\":\"page-1\",\"title\":\"Page 1\",\"widgets\":[],\"gridLayout\":[]}]}'::jsonb" - }, - "thumbnailJson": { - "name": "thumbnailJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "isPublic": { - "name": "isPublic", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_by": { - "name": "updated_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_userId_user_id_fk": { - "name": "dashboard_userId_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_updated_by_user_id_fk": { - "name": "dashboard_updated_by_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": ["updated_by"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sso_provider": { - "name": "sso_provider", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "protocol": { - "name": "protocol", - "type": "sso_protocol", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'oidc'" - }, - "issuer": { - "name": "issuer", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "client_id": { - "name": "client_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "client_secret_encrypted": { - "name": "client_secret_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scopes": { - "name": "scopes", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'openid profile email'" - }, - "claim_mappings": { - "name": "claim_mappings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "auto_provision": { - "name": "auto_provision", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "default_role": { - "name": "default_role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "enforce_sso": { - "name": "enforce_sso", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sso_provider_tenant_issuer_unique": { - "name": "sso_provider_tenant_issuer_unique", - "nullsNotDistinct": false, - "columns": ["tenant_id", "issuer"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "passwordHash": { - "name": "passwordHash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "can_write": { - "name": "can_write", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "force_password_change": { - "name": "force_password_change", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passwordChangedAt": { - "name": "passwordChangedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "disabledAt": { - "name": "disabledAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "lastLoginAt": { - "name": "lastLoginAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_tenant_unique": { - "name": "user_email_tenant_unique", - "nullsNotDistinct": false, - "columns": ["email", "tenant_id"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verificationToken": { - "name": "verificationToken", - "schema": "", - "columns": { - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.widget_template": { - "name": "widget_template", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "chartType": { - "name": "chartType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectorType": { - "name": "connectorType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectionId": { - "name": "connectionId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "query": { - "name": "query", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "params": { - "name": "params", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "settings": { - "name": "settings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "previewImageUrl": { - "name": "previewImageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "createdBy": { - "name": "createdBy", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "widget_template_createdBy_user_id_fk": { - "name": "widget_template_createdBy_user_id_fk", - "tableFrom": "widget_template", - "tableTo": "user", - "columnsFrom": ["createdBy"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.connection_type": { - "name": "connection_type", - "schema": "public", - "values": ["neo4j", "postgresql"] - }, - "public.connection_visibility": { - "name": "connection_visibility", - "schema": "public", - "values": ["private", "shared"] - }, - "public.share_role": { - "name": "share_role", - "schema": "public", - "values": ["viewer", "editor"] - }, - "public.sso_protocol": { - "name": "sso_protocol", - "schema": "public", - "values": ["oidc"] - }, - "public.user_role": { - "name": "user_role", - "schema": "public", - "values": ["admin", "creator", "reader"] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/app/drizzle/migrations/meta/0010_snapshot.json b/app/drizzle/migrations/meta/0010_snapshot.json deleted file mode 100644 index 249f7222..00000000 --- a/app/drizzle/migrations/meta/0010_snapshot.json +++ /dev/null @@ -1,1045 +0,0 @@ -{ - "id": "aba2fceb-6d35-4394-bf30-a78bf205c014", - "prevId": "aa735688-7be4-4a2b-955a-cabed6352a06", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "providerAccountId": { - "name": "providerAccountId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "token_type": { - "name": "token_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "id_token": { - "name": "id_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "session_state": { - "name": "session_state", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.api_key": { - "name": "api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key_prefix": { - "name": "key_prefix", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "last_used_at": { - "name": "last_used_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "api_key_userId_user_id_fk": { - "name": "api_key_userId_user_id_fk", - "tableFrom": "api_key", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "api_key_key_hash_unique": { - "name": "api_key_key_hash_unique", - "nullsNotDistinct": false, - "columns": [ - "key_hash" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.audit_log": { - "name": "audit_log", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "resource_type": { - "name": "resource_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "resource_id": { - "name": "resource_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_user_id_user_id_fk": { - "name": "audit_log_user_id_user_id_fk", - "tableFrom": "audit_log", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.connection": { - "name": "connection", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "connection_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "configEncrypted": { - "name": "configEncrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "allow_per_card_db": { - "name": "allow_per_card_db", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "visibility": { - "name": "visibility", - "type": "connection_visibility", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "connection_userId_user_id_fk": { - "name": "connection_userId_user_id_fk", - "tableFrom": "connection", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard_share": { - "name": "dashboard_share", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "dashboardId": { - "name": "dashboardId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "role": { - "name": "role", - "type": "share_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_share_dashboardId_dashboard_id_fk": { - "name": "dashboard_share_dashboardId_dashboard_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "dashboard", - "columnsFrom": [ - "dashboardId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_share_userId_user_id_fk": { - "name": "dashboard_share_userId_user_id_fk", - "tableFrom": "dashboard_share", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "layoutJson": { - "name": "layoutJson", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{\"version\":2,\"pages\":[{\"id\":\"page-1\",\"title\":\"Page 1\",\"widgets\":[],\"gridLayout\":[]}]}'::jsonb" - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "isPublic": { - "name": "isPublic", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_by": { - "name": "updated_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_userId_user_id_fk": { - "name": "dashboard_userId_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "dashboard_updated_by_user_id_fk": { - "name": "dashboard_updated_by_user_id_fk", - "tableFrom": "dashboard", - "tableTo": "user", - "columnsFrom": [ - "updated_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "userId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sso_provider": { - "name": "sso_provider", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "protocol": { - "name": "protocol", - "type": "sso_protocol", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'oidc'" - }, - "issuer": { - "name": "issuer", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "client_id": { - "name": "client_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "client_secret_encrypted": { - "name": "client_secret_encrypted", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scopes": { - "name": "scopes", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'openid profile email'" - }, - "claim_mappings": { - "name": "claim_mappings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "auto_provision": { - "name": "auto_provision", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "default_role": { - "name": "default_role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "enforce_sso": { - "name": "enforce_sso", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "sso_provider_tenant_issuer_unique": { - "name": "sso_provider_tenant_issuer_unique", - "nullsNotDistinct": false, - "columns": [ - "tenant_id", - "issuer" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "passwordHash": { - "name": "passwordHash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "user_role", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'creator'" - }, - "can_write": { - "name": "can_write", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "force_password_change": { - "name": "force_password_change", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "passwordChangedAt": { - "name": "passwordChangedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "disabledAt": { - "name": "disabledAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "lastLoginAt": { - "name": "lastLoginAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_tenant_unique": { - "name": "user_email_tenant_unique", - "nullsNotDistinct": false, - "columns": [ - "email", - "tenant_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verificationToken": { - "name": "verificationToken", - "schema": "", - "columns": { - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.widget_template": { - "name": "widget_template", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "chartType": { - "name": "chartType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectorType": { - "name": "connectorType", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "connectionId": { - "name": "connectionId", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "query": { - "name": "query", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "params": { - "name": "params", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "settings": { - "name": "settings", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "previewImageUrl": { - "name": "previewImageUrl", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "createdBy": { - "name": "createdBy", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'default'" - }, - "createdAt": { - "name": "createdAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updatedAt": { - "name": "updatedAt", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "widget_template_createdBy_user_id_fk": { - "name": "widget_template_createdBy_user_id_fk", - "tableFrom": "widget_template", - "tableTo": "user", - "columnsFrom": [ - "createdBy" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.connection_type": { - "name": "connection_type", - "schema": "public", - "values": [ - "neo4j", - "postgresql" - ] - }, - "public.connection_visibility": { - "name": "connection_visibility", - "schema": "public", - "values": [ - "private", - "shared" - ] - }, - "public.share_role": { - "name": "share_role", - "schema": "public", - "values": [ - "viewer", - "editor" - ] - }, - "public.sso_protocol": { - "name": "sso_protocol", - "schema": "public", - "values": [ - "oidc" - ] - }, - "public.user_role": { - "name": "user_role", - "schema": "public", - "values": [ - "admin", - "creator", - "reader" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/app/drizzle/migrations/meta/_journal.json b/app/drizzle/migrations/meta/_journal.json index ba974406..aaacb07a 100644 --- a/app/drizzle/migrations/meta/_journal.json +++ b/app/drizzle/migrations/meta/_journal.json @@ -5,79 +5,9 @@ { "idx": 0, "version": "7", - "when": 1773765270786, - "tag": "0000_wooden_zeigeist", - "breakpoints": true - }, - { - "idx": 1, - "version": "7", - "when": 1775088043513, - "tag": "0001_rapid_iron_monger", - "breakpoints": true - }, - { - "idx": 2, - "version": "7", - "when": 1775596690039, - "tag": "0002_redundant_night_nurse", - "breakpoints": true - }, - { - "idx": 3, - "version": "7", - "when": 1776890185225, - "tag": "0003_loving_centennial", - "breakpoints": true - }, - { - "idx": 4, - "version": "7", - "when": 1777474513745, - "tag": "0004_furry_scourge", - "breakpoints": true - }, - { - "idx": 5, - "version": "7", - "when": 1778862246888, - "tag": "0005_perfect_paibok", - "breakpoints": true - }, - { - "idx": 6, - "version": "7", - "when": 1778862281231, - "tag": "0006_busy_champions", - "breakpoints": true - }, - { - "idx": 7, - "version": "7", - "when": 1778862299752, - "tag": "0007_free_loners", - "breakpoints": true - }, - { - "idx": 8, - "version": "7", - "when": 1781144139217, - "tag": "0008_lumpy_jubilee", - "breakpoints": true - }, - { - "idx": 9, - "version": "7", - "when": 1781383285524, - "tag": "0009_dazzling_stranger", - "breakpoints": true - }, - { - "idx": 10, - "version": "7", - "when": 1781532674061, - "tag": "0010_tiny_amphibian", + "when": 1782898508468, + "tag": "0000_cooing_greymalkin", "breakpoints": true } ] -} \ No newline at end of file +} diff --git a/app/src/app/api/connections/__tests__/route.test.ts b/app/src/app/api/connections/__tests__/route.test.ts index cf06b035..19bce26e 100644 --- a/app/src/app/api/connections/__tests__/route.test.ts +++ b/app/src/app/api/connections/__tests__/route.test.ts @@ -47,6 +47,11 @@ vi.mock("@/lib/connector/schema-prefetch", () => ({ prefetchSchema: mockPrefetchSchema, })); vi.mock("next/server", () => nextResponseMockFactory()); +// Connector-type validation is registry-driven (#1121); stub it so the route +// tests don't load the driver-heavy connection registry. +vi.mock("@/lib/connector/registered-types", () => ({ + isRegisteredConnectorType: (t: string) => t === "neo4j" || t === "postgresql", +})); vi.mock("@/lib/auth/errors", () => ({ UnauthorizedError, ForbiddenError })); const SESSION = { diff --git a/app/src/app/api/connections/list-databases-inline/__tests__/route.test.ts b/app/src/app/api/connections/list-databases-inline/__tests__/route.test.ts index 3fd17b49..1a723f18 100644 --- a/app/src/app/api/connections/list-databases-inline/__tests__/route.test.ts +++ b/app/src/app/api/connections/list-databases-inline/__tests__/route.test.ts @@ -23,6 +23,11 @@ vi.mock("@/lib/query/query-executor", () => ({ listSchemas: mockListSchemas, })); vi.mock("next/server", () => nextResponseMockFactory()); +// Connector-type validation is registry-driven (#1121); stub it so the route +// tests don't load the driver-heavy connection registry. +vi.mock("@/lib/connector/registered-types", () => ({ + isRegisteredConnectorType: (t: string) => t === "neo4j" || t === "postgresql", +})); vi.mock("@/lib/auth/errors", () => ({ UnauthorizedError: class extends Error { constructor() { diff --git a/app/src/app/api/connections/test-inline/__tests__/route.test.ts b/app/src/app/api/connections/test-inline/__tests__/route.test.ts index 34c62f87..50ccd016 100644 --- a/app/src/app/api/connections/test-inline/__tests__/route.test.ts +++ b/app/src/app/api/connections/test-inline/__tests__/route.test.ts @@ -21,6 +21,11 @@ vi.mock("@/lib/query/query-executor", () => ({ testConnection: mockTestConnection, })); vi.mock("next/server", () => nextResponseMockFactory()); +// Connector-type validation is registry-driven (#1121); stub it so the route +// tests don't load the driver-heavy connection registry. +vi.mock("@/lib/connector/registered-types", () => ({ + isRegisteredConnectorType: (t: string) => t === "neo4j" || t === "postgresql", +})); const SESSION = { userId: "user-1", diff --git a/app/src/lib/__tests__/connector/registered-types.test.ts b/app/src/lib/__tests__/connector/registered-types.test.ts new file mode 100644 index 00000000..59766188 --- /dev/null +++ b/app/src/lib/__tests__/connector/registered-types.test.ts @@ -0,0 +1,30 @@ +import { describe, it, expect, vi } from "vitest"; + +// Mock the connection-adapter seam so this stays a pure unit test (no drivers). +vi.mock("@/lib/connector/connection-adapter", () => ({ + getConnector: (type: string) => + type === "neo4j" || type === "postgresql" ? { type } : undefined, + getAllConnectors: () => [{ type: "neo4j" }, { type: "postgresql" }], +})); + +import { + isRegisteredConnectorType, + registeredConnectorTypes, +} from "@/lib/connector/registered-types"; + +describe("isRegisteredConnectorType", () => { + it("returns true for a registered connector type", () => { + expect(isRegisteredConnectorType("neo4j")).toBe(true); + expect(isRegisteredConnectorType("postgresql")).toBe(true); + }); + + it("returns false for an unregistered type", () => { + expect(isRegisteredConnectorType("mysql")).toBe(false); + }); +}); + +describe("registeredConnectorTypes", () => { + it("lists all registered connector type identifiers", () => { + expect(registeredConnectorTypes()).toEqual(["neo4j", "postgresql"]); + }); +}); diff --git a/app/src/lib/__tests__/query/query-executor-core.test.ts b/app/src/lib/__tests__/query/query-executor-core.test.ts index 74d61c0f..f1b6c6ad 100644 --- a/app/src/lib/__tests__/query/query-executor-core.test.ts +++ b/app/src/lib/__tests__/query/query-executor-core.test.ts @@ -20,7 +20,7 @@ const mockCreateConnectionModule = vi.fn(() => ({ vi.mock("@/lib/connector/connection-adapter", () => ({ createConnectionModule: mockCreateConnectionModule, DEFAULT_CONNECTION_CONFIG: { connectionTimeout: 30000, timeout: 30000 }, - ConnectionTypes: { NEO4J: 1, POSTGRESQL: 2 }, + ConnectionTypes: { UNKNOWN: 0, NEO4J: 1, POSTGRESQL: 2 }, })); // Mirror the QueryStatus enum from @neoboard/connection (integer values are @@ -58,7 +58,7 @@ describe("query-executor", () => { vi.doMock("../connection-adapter", () => ({ createConnectionModule: mockCreateConnectionModule, DEFAULT_CONNECTION_CONFIG: { connectionTimeout: 30000, timeout: 30000 }, - ConnectionTypes: { NEO4J: 1, POSTGRESQL: 2 }, + ConnectionTypes: { UNKNOWN: 0, NEO4J: 1, POSTGRESQL: 2 }, })); const mod = await import("@/lib/query/query-executor"); executeQuery = mod.executeQuery; @@ -111,6 +111,24 @@ describe("query-executor", () => { }); }); + it("maps a registry-supplied connector type to its module (#1121)", async () => { + mockRunQuery.mockImplementation( + (_p: unknown, cbs: { onSuccess: (v: unknown) => void }) => { + cbs.onSuccess([{ x: 1 }]); + }, + ); + + // A type that isn't a built-in — the executor must still resolve its + // module through the registry (createConnectionModule), no per-type branch. + await executeQuery("mysql", pgCreds, { query: "SELECT 1" }); + + expect(mockCreateConnectionModule).toHaveBeenCalledWith( + "mysql", + expect.objectContaining({ uri: pgCreds.uri }), + expect.any(Object), + ); + }); + it("rejects when runQuery calls onFail", async () => { mockRunQuery.mockImplementation( (_p: unknown, cbs: { onFail: (v: unknown) => void }) => { @@ -690,7 +708,7 @@ describe("query-executor", () => { vi.doMock("../connection-adapter", () => ({ createConnectionModule: mockCreateConnectionModule, DEFAULT_CONNECTION_CONFIG: { connectionTimeout: 30000, timeout: 30000 }, - ConnectionTypes: { NEO4J: 1, POSTGRESQL: 2 }, + ConnectionTypes: { UNKNOWN: 0, NEO4J: 1, POSTGRESQL: 2 }, })); const mod = await import("@/lib/query/query-executor"); listDatabases = mod.listDatabases; @@ -729,7 +747,7 @@ describe("query-executor", () => { vi.doMock("../connection-adapter", () => ({ createConnectionModule: mockCreateConnectionModule, DEFAULT_CONNECTION_CONFIG: { connectionTimeout: 30000, timeout: 30000 }, - ConnectionTypes: { NEO4J: 1, POSTGRESQL: 2 }, + ConnectionTypes: { UNKNOWN: 0, NEO4J: 1, POSTGRESQL: 2 }, })); const mod = await import("@/lib/query/query-executor"); listSchemas = mod.listSchemas; diff --git a/app/src/lib/__tests__/shared/schemas.test.ts b/app/src/lib/__tests__/shared/schemas.test.ts index b2df9ebf..e93f60bf 100644 --- a/app/src/lib/__tests__/shared/schemas.test.ts +++ b/app/src/lib/__tests__/shared/schemas.test.ts @@ -1,4 +1,13 @@ -import { describe, it, expect } from "vitest"; +import { describe, it, expect, vi } from "vitest"; + +// Connector-type validation is registry-driven (#1121). Mock the registry +// membership check so the schema tests are deterministic and don't load DB +// drivers: built-ins + one fixture type are "registered". +vi.mock("@/lib/connector/registered-types", () => ({ + isRegisteredConnectorType: (t: string) => + ["neo4j", "postgresql", "fixture-db"].includes(t), +})); + import { connectionConfigSchema, createConnectionSchema, @@ -189,6 +198,15 @@ describe("createConnectionSchema", () => { expect(result.success).toBe(true); }); + it("accepts a registry-supplied connector type (no core change per type)", () => { + const result = createConnectionSchema.safeParse({ + name: "My Fixture", + type: "fixture-db", + config: { uri: "fixture://host", username: "u", password: "p" }, + }); + expect(result.success).toBe(true); + }); + it("rejects missing name", () => { const result = createConnectionSchema.safeParse({ type: "neo4j", diff --git a/app/src/lib/connector/connection-adapter.ts b/app/src/lib/connector/connection-adapter.ts index 777b16cf..1e0d9edf 100644 --- a/app/src/lib/connector/connection-adapter.ts +++ b/app/src/lib/connector/connection-adapter.ts @@ -10,6 +10,8 @@ import { DEFAULT_CONNECTION_CONFIG, ConnectionTypes, getSchemaManager, + getConnector, + getAllConnectors, } from "@neoboard/connection"; export { @@ -17,4 +19,6 @@ export { DEFAULT_CONNECTION_CONFIG, ConnectionTypes, getSchemaManager, + getConnector, + getAllConnectors, }; diff --git a/app/src/lib/connector/registered-types.ts b/app/src/lib/connector/registered-types.ts new file mode 100644 index 00000000..0bd22567 --- /dev/null +++ b/app/src/lib/connector/registered-types.ts @@ -0,0 +1,20 @@ +import { getConnector, getAllConnectors } from "./connection-adapter"; + +/** + * Connector-type membership checks driven by the runtime registry (#1121), + * so a registry-supplied connector is first-class — no hardcoded + * `"neo4j" | "postgresql"` union in validation/execution. + * + * Server-side only (the registry pulls DB drivers). Routed through + * connection-adapter so it stays mockable in unit tests. + */ + +/** True if `type` is a registered connector (built-in or external). */ +export function isRegisteredConnectorType(type: string): boolean { + return getConnector(type) !== undefined; +} + +/** All registered connector type identifiers. */ +export function registeredConnectorTypes(): string[] { + return getAllConnectors().map((p) => p.type); +} diff --git a/app/src/lib/connector/schema-prefetch.ts b/app/src/lib/connector/schema-prefetch.ts index 4e828604..70b4cc68 100644 --- a/app/src/lib/connector/schema-prefetch.ts +++ b/app/src/lib/connector/schema-prefetch.ts @@ -1,5 +1,4 @@ import type { ConnectionCredentials } from "@/lib/query/query-executor"; -import type { ConnectorType } from "@/lib/connector/connector-types"; import { ensureDatabaseInUri } from "@/lib/query/query-params"; import { getSchemaManager } from "@/lib/connector/connection-adapter"; @@ -22,7 +21,7 @@ export function buildAuthConfig(credentials: ConnectionCredentials) { * after connection create/update. */ export async function fetchConnectionSchema( - type: ConnectorType, + type: string, credentials: ConnectionCredentials, ): Promise { // Registry-keyed dispatch (#1119) — no hardcoded per-type branching. @@ -36,7 +35,7 @@ export async function fetchConnectionSchema( * Errors are swallowed — schema is a cache; failure is non-critical. */ export function prefetchSchema( - type: ConnectorType, + type: string, credentials: ConnectionCredentials, ): void { fetchConnectionSchema(type, credentials).catch(() => { diff --git a/app/src/lib/db/schema.ts b/app/src/lib/db/schema.ts index 95f899e9..afe72ef5 100644 --- a/app/src/lib/db/schema.ts +++ b/app/src/lib/db/schema.ts @@ -94,10 +94,9 @@ export const verificationTokens = pgTable( // ─── Application tables ────────────────────────────────────────────── -export const connectionTypeEnum = pgEnum("connection_type", [ - "neo4j", - "postgresql", -]); +// Connection type is a plain text column (#1121): the accepted set is the +// connector registry (built-in + registry-supplied), validated at the API +// layer via schemas.ts — not a fixed DB enum. export const connectionVisibilityEnum = pgEnum("connection_visibility", [ "private", @@ -113,7 +112,7 @@ export const connections = pgTable("connection", { .references(() => users.id, { onDelete: "cascade" }), tenantId: text("tenant_id").notNull().default("default"), name: text("name").notNull(), - type: connectionTypeEnum("type").notNull(), + type: text("type").notNull(), configEncrypted: text("configEncrypted").notNull(), /** When true, widget editors can override the connection's default database per-card. */ allowPerCardDb: boolean("allow_per_card_db").notNull().default(true), diff --git a/app/src/lib/query/pipeline-types.ts b/app/src/lib/query/pipeline-types.ts index 2c62a78c..cea29d87 100644 --- a/app/src/lib/query/pipeline-types.ts +++ b/app/src/lib/query/pipeline-types.ts @@ -1,5 +1,3 @@ -import type { ConnectorType } from "@/lib/connector/connector-types"; - /** * Execution context that flows through the middleware pipeline. * @@ -11,7 +9,8 @@ export interface QueryContext { query: string; params: Record; connectionId: string; - connectionType: ConnectorType; + /** Connector type — any registry-registered type, not a fixed union (#1121). */ + connectionType: string; userId: string; tenantId: string; accessMode: "read" | "write"; diff --git a/app/src/lib/query/query-executor.ts b/app/src/lib/query/query-executor.ts index 7f3a5067..13954df5 100644 --- a/app/src/lib/query/query-executor.ts +++ b/app/src/lib/query/query-executor.ts @@ -4,7 +4,6 @@ import { ConnectionTypes, } from "@/lib/connector/connection-adapter"; import { ensureDatabaseInUri, rewriteParamsForPostgres } from "./query-params"; -import type { ConnectorType } from "@/lib/connector/connector-types"; import { QueryStatus } from "@neoboard/connection"; /** @@ -38,11 +37,21 @@ export interface ConnectionCredentials { maxRows?: number; } -export type DbType = ConnectorType; +// Registry-supplied connectors are first-class (#1121): a connector type is +// any registered string, not just the built-in union. createConnectionModule +// resolves it via the registry; built-in-specific branches (pg param rewrite, +// statement timeout) key off the literal type and safely no-op for others. +export type DbType = string; -/** Numeric type for connection module config (legacy enum). */ +/** + * Numeric type for connection module config (legacy enum). Registry-supplied + * connectors have no built-in numeric identity → UNKNOWN, rather than being + * mislabeled as PostgreSQL (#1121). + */ function toConnectionTypeEnum(type: DbType): number { - return type === "neo4j" ? ConnectionTypes.NEO4J : ConnectionTypes.POSTGRESQL; + if (type === "neo4j") return ConnectionTypes.NEO4J; + if (type === "postgresql") return ConnectionTypes.POSTGRESQL; + return ConnectionTypes.UNKNOWN; } /** diff --git a/app/src/lib/shared/schemas.ts b/app/src/lib/shared/schemas.ts index ae84f919..c2c9facb 100644 --- a/app/src/lib/shared/schemas.ts +++ b/app/src/lib/shared/schemas.ts @@ -1,11 +1,20 @@ import { z } from "zod"; -import { CONNECTOR_TYPES } from "@/lib/connector/connector-types"; +import { isRegisteredConnectorType } from "@/lib/connector/registered-types"; /** * Shared Zod schemas for API route validation. * Extracted to avoid duplication across connection routes. */ +/** + * Connector type accepted by the API — any type registered in the connector + * registry (built-in or external), not a hardcoded union (#1121). + */ +const connectorTypeSchema = z + .string() + .min(1) + .refine(isRegisteredConnectorType, { message: "Unknown connector type" }); + export const connectionConfigSchema = z.object({ uri: z.string().min(1), username: z.string().min(1), @@ -35,7 +44,7 @@ export const connectionConfigSchema = z.object({ export const createConnectionSchema = z.object({ name: z.string().min(1), - type: z.enum(CONNECTOR_TYPES), + type: connectorTypeSchema, config: connectionConfigSchema, }); @@ -52,6 +61,6 @@ export const updateConnectionSchema = z.object({ }); export const testInlineSchema = z.object({ - type: z.enum(CONNECTOR_TYPES), + type: connectorTypeSchema, config: connectionConfigSchema, }); diff --git a/connector-sdk/src/ConnectionModuleConfig.ts b/connector-sdk/src/ConnectionModuleConfig.ts index a6b36422..7622930e 100644 --- a/connector-sdk/src/ConnectionModuleConfig.ts +++ b/connector-sdk/src/ConnectionModuleConfig.ts @@ -5,7 +5,8 @@ * Use the factory pattern (createConnectionModule) to instantiate modules. */ export enum ConnectionTypes { + /** Registry-supplied connector with no built-in numeric identity (#1121). */ + UNKNOWN = 0, NEO4J = 1, POSTGRESQL = 2, } -