summaryrefslogtreecommitdiffhomepage
path: root/cloud/core/migrations
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-09-02 03:14:56 -0400
committerDax Raad <[email protected]>2025-09-02 03:18:30 -0400
commit810c9cff1db91f10158cc002dc70b89871762e1e (patch)
tree108ea81a51856003bad4d376a6a0fa79e5964216 /cloud/core/migrations
parent47d4c87bdd358f69be5a5612868b5127de1922a3 (diff)
downloadopencode-810c9cff1db91f10158cc002dc70b89871762e1e.tar.gz
opencode-810c9cff1db91f10158cc002dc70b89871762e1e.zip
wip: cloud
Diffstat (limited to 'cloud/core/migrations')
-rw-r--r--cloud/core/migrations/0000_amused_mojo.sql66
-rw-r--r--cloud/core/migrations/0000_fluffy_raza.sql89
-rw-r--r--cloud/core/migrations/0001_thankful_chat.sql8
-rw-r--r--cloud/core/migrations/0002_stale_jackal.sql14
-rw-r--r--cloud/core/migrations/0003_tranquil_spencer_smythe.sql1
-rw-r--r--cloud/core/migrations/meta/0000_snapshot.json504
-rw-r--r--cloud/core/migrations/meta/0001_snapshot.json515
-rw-r--r--cloud/core/migrations/meta/0002_snapshot.json615
-rw-r--r--cloud/core/migrations/meta/0003_snapshot.json609
-rw-r--r--cloud/core/migrations/meta/_journal.json29
10 files changed, 412 insertions, 2038 deletions
diff --git a/cloud/core/migrations/0000_amused_mojo.sql b/cloud/core/migrations/0000_amused_mojo.sql
deleted file mode 100644
index 75441ad24..000000000
--- a/cloud/core/migrations/0000_amused_mojo.sql
+++ /dev/null
@@ -1,66 +0,0 @@
-CREATE TABLE "billing" (
- "id" varchar(30) NOT NULL,
- "workspace_id" varchar(30) NOT NULL,
- "time_created" timestamp with time zone DEFAULT now() NOT NULL,
- "time_deleted" timestamp with time zone,
- "customer_id" varchar(255),
- "payment_method_id" varchar(255),
- "payment_method_last4" varchar(4),
- "balance" bigint NOT NULL,
- "reload" boolean,
- CONSTRAINT "billing_workspace_id_id_pk" PRIMARY KEY("workspace_id","id")
-);
---> statement-breakpoint
-CREATE TABLE "payment" (
- "id" varchar(30) NOT NULL,
- "workspace_id" varchar(30) NOT NULL,
- "time_created" timestamp with time zone DEFAULT now() NOT NULL,
- "time_deleted" timestamp with time zone,
- "customer_id" varchar(255),
- "payment_id" varchar(255),
- "amount" bigint NOT NULL,
- CONSTRAINT "payment_workspace_id_id_pk" PRIMARY KEY("workspace_id","id")
-);
---> statement-breakpoint
-CREATE TABLE "usage" (
- "id" varchar(30) NOT NULL,
- "workspace_id" varchar(30) NOT NULL,
- "time_created" timestamp with time zone DEFAULT now() NOT NULL,
- "time_deleted" timestamp with time zone,
- "request_id" varchar(255),
- "model" varchar(255) NOT NULL,
- "input_tokens" integer NOT NULL,
- "output_tokens" integer NOT NULL,
- "reasoning_tokens" integer,
- "cache_read_tokens" integer,
- "cache_write_tokens" integer,
- "cost" bigint NOT NULL,
- CONSTRAINT "usage_workspace_id_id_pk" PRIMARY KEY("workspace_id","id")
-);
---> statement-breakpoint
-CREATE TABLE "user" (
- "id" varchar(30) NOT NULL,
- "workspace_id" varchar(30) NOT NULL,
- "time_created" timestamp with time zone DEFAULT now() NOT NULL,
- "time_deleted" timestamp with time zone,
- "email" text NOT NULL,
- "name" varchar(255) NOT NULL,
- "time_seen" timestamp with time zone,
- "color" integer,
- CONSTRAINT "user_workspace_id_id_pk" PRIMARY KEY("workspace_id","id")
-);
---> statement-breakpoint
-CREATE TABLE "workspace" (
- "id" varchar(30) PRIMARY KEY NOT NULL,
- "slug" varchar(255),
- "name" varchar(255),
- "time_created" timestamp with time zone DEFAULT now() NOT NULL,
- "time_deleted" timestamp with time zone
-);
---> statement-breakpoint
-ALTER TABLE "billing" ADD CONSTRAINT "billing_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
-ALTER TABLE "payment" ADD CONSTRAINT "payment_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
-ALTER TABLE "usage" ADD CONSTRAINT "usage_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
-ALTER TABLE "user" ADD CONSTRAINT "user_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
-CREATE UNIQUE INDEX "user_email" ON "user" USING btree ("workspace_id","email");--> statement-breakpoint
-CREATE UNIQUE INDEX "slug" ON "workspace" USING btree ("slug"); \ No newline at end of file
diff --git a/cloud/core/migrations/0000_fluffy_raza.sql b/cloud/core/migrations/0000_fluffy_raza.sql
new file mode 100644
index 000000000..8e8173346
--- /dev/null
+++ b/cloud/core/migrations/0000_fluffy_raza.sql
@@ -0,0 +1,89 @@
+CREATE TABLE `account` (
+ `id` varchar(30) NOT NULL,
+ `time_created` timestamp(3) NOT NULL DEFAULT (now()),
+ `time_updated` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
+ `time_deleted` timestamp(3),
+ `email` varchar(255) NOT NULL,
+ CONSTRAINT `email` UNIQUE(`email`)
+);
+--> statement-breakpoint
+CREATE TABLE `billing` (
+ `id` varchar(30) NOT NULL,
+ `workspace_id` varchar(30) NOT NULL,
+ `time_created` timestamp(3) NOT NULL DEFAULT (now()),
+ `time_updated` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
+ `time_deleted` timestamp(3),
+ `customer_id` varchar(255),
+ `payment_method_id` varchar(255),
+ `payment_method_last4` varchar(4),
+ `balance` bigint NOT NULL,
+ `reload` boolean,
+ CONSTRAINT `billing_workspace_id_id_pk` PRIMARY KEY(`workspace_id`,`id`)
+);
+--> statement-breakpoint
+CREATE TABLE `payment` (
+ `id` varchar(30) NOT NULL,
+ `workspace_id` varchar(30) NOT NULL,
+ `time_created` timestamp(3) NOT NULL DEFAULT (now()),
+ `time_updated` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
+ `time_deleted` timestamp(3),
+ `customer_id` varchar(255),
+ `payment_id` varchar(255),
+ `amount` bigint NOT NULL,
+ CONSTRAINT `payment_workspace_id_id_pk` PRIMARY KEY(`workspace_id`,`id`)
+);
+--> statement-breakpoint
+CREATE TABLE `usage` (
+ `id` varchar(30) NOT NULL,
+ `workspace_id` varchar(30) NOT NULL,
+ `time_created` timestamp(3) NOT NULL DEFAULT (now()),
+ `time_updated` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
+ `time_deleted` timestamp(3),
+ `model` varchar(255) NOT NULL,
+ `input_tokens` int NOT NULL,
+ `output_tokens` int NOT NULL,
+ `reasoning_tokens` int,
+ `cache_read_tokens` int,
+ `cache_write_tokens` int,
+ `cost` bigint NOT NULL,
+ CONSTRAINT `usage_workspace_id_id_pk` PRIMARY KEY(`workspace_id`,`id`)
+);
+--> statement-breakpoint
+CREATE TABLE `key` (
+ `id` varchar(30) NOT NULL,
+ `workspace_id` varchar(30) NOT NULL,
+ `time_created` timestamp(3) NOT NULL DEFAULT (now()),
+ `time_updated` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
+ `time_deleted` timestamp(3),
+ `user_id` text NOT NULL,
+ `name` varchar(255) NOT NULL,
+ `key` varchar(255) NOT NULL,
+ `time_used` timestamp(3),
+ CONSTRAINT `key_workspace_id_id_pk` PRIMARY KEY(`workspace_id`,`id`),
+ CONSTRAINT `global_key` UNIQUE(`key`)
+);
+--> statement-breakpoint
+CREATE TABLE `user` (
+ `id` varchar(30) NOT NULL,
+ `workspace_id` varchar(30) NOT NULL,
+ `time_created` timestamp(3) NOT NULL DEFAULT (now()),
+ `time_updated` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
+ `time_deleted` timestamp(3),
+ `email` varchar(255) NOT NULL,
+ `name` varchar(255) NOT NULL,
+ `time_seen` timestamp(3),
+ `color` int,
+ CONSTRAINT `user_workspace_id_id_pk` PRIMARY KEY(`workspace_id`,`id`),
+ CONSTRAINT `user_email` UNIQUE(`workspace_id`,`email`)
+);
+--> statement-breakpoint
+CREATE TABLE `workspace` (
+ `id` varchar(30) NOT NULL,
+ `slug` varchar(255),
+ `name` varchar(255),
+ `time_created` timestamp(3) NOT NULL DEFAULT (now()),
+ `time_updated` timestamp(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
+ `time_deleted` timestamp(3),
+ CONSTRAINT `workspace_id` PRIMARY KEY(`id`),
+ CONSTRAINT `slug` UNIQUE(`slug`)
+);
diff --git a/cloud/core/migrations/0001_thankful_chat.sql b/cloud/core/migrations/0001_thankful_chat.sql
deleted file mode 100644
index 9c66a6ac4..000000000
--- a/cloud/core/migrations/0001_thankful_chat.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-CREATE TABLE "account" (
- "id" varchar(30) NOT NULL,
- "time_created" timestamp with time zone DEFAULT now() NOT NULL,
- "time_deleted" timestamp with time zone,
- "email" varchar(255) NOT NULL
-);
---> statement-breakpoint
-CREATE UNIQUE INDEX "email" ON "account" USING btree ("email"); \ No newline at end of file
diff --git a/cloud/core/migrations/0002_stale_jackal.sql b/cloud/core/migrations/0002_stale_jackal.sql
deleted file mode 100644
index 267dff273..000000000
--- a/cloud/core/migrations/0002_stale_jackal.sql
+++ /dev/null
@@ -1,14 +0,0 @@
-CREATE TABLE "key" (
- "id" varchar(30) NOT NULL,
- "workspace_id" varchar(30) NOT NULL,
- "time_created" timestamp with time zone DEFAULT now() NOT NULL,
- "time_deleted" timestamp with time zone,
- "user_id" text NOT NULL,
- "name" varchar(255) NOT NULL,
- "key" varchar(255) NOT NULL,
- "time_used" timestamp with time zone,
- CONSTRAINT "key_workspace_id_id_pk" PRIMARY KEY("workspace_id","id")
-);
---> statement-breakpoint
-ALTER TABLE "key" ADD CONSTRAINT "key_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
-CREATE UNIQUE INDEX "global_key" ON "key" USING btree ("key"); \ No newline at end of file
diff --git a/cloud/core/migrations/0003_tranquil_spencer_smythe.sql b/cloud/core/migrations/0003_tranquil_spencer_smythe.sql
deleted file mode 100644
index 4f57f779f..000000000
--- a/cloud/core/migrations/0003_tranquil_spencer_smythe.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE "usage" DROP COLUMN "request_id"; \ No newline at end of file
diff --git a/cloud/core/migrations/meta/0000_snapshot.json b/cloud/core/migrations/meta/0000_snapshot.json
index 3b86bed25..623ec4930 100644
--- a/cloud/core/migrations/meta/0000_snapshot.json
+++ b/cloud/core/migrations/meta/0000_snapshot.json
@@ -1,85 +1,142 @@
{
- "id": "9b5cec8c-8b59-4d7a-bb5c-76ade1c83d6f",
+ "version": "5",
+ "dialect": "mysql",
+ "id": "aee779c5-db1d-4655-95ec-6451c18455be",
"prevId": "00000000-0000-0000-0000-000000000000",
- "version": "7",
- "dialect": "postgresql",
"tables": {
- "public.billing": {
+ "account": {
+ "name": "account",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "time_created": {
+ "name": "time_created",
+ "type": "timestamp(3)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "time_updated": {
+ "name": "time_updated",
+ "type": "timestamp(3)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)"
+ },
+ "time_deleted": {
+ "name": "time_deleted",
+ "type": "timestamp(3)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "email": {
+ "name": "email",
+ "columns": [
+ "email"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "billing": {
"name": "billing",
- "schema": "",
"columns": {
"id": {
"name": "id",
"type": "varchar(30)",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"workspace_id": {
"name": "workspace_id",
"type": "varchar(30)",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"time_created": {
"name": "time_created",
- "type": "timestamp with time zone",
+ "type": "timestamp(3)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "time_updated": {
+ "name": "time_updated",
+ "type": "timestamp(3)",
"primaryKey": false,
"notNull": true,
- "default": "now()"
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)"
},
"time_deleted": {
"name": "time_deleted",
- "type": "timestamp with time zone",
+ "type": "timestamp(3)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"customer_id": {
"name": "customer_id",
"type": "varchar(255)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"payment_method_id": {
"name": "payment_method_id",
"type": "varchar(255)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"payment_method_last4": {
"name": "payment_method_last4",
"type": "varchar(4)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"balance": {
"name": "balance",
"type": "bigint",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"reload": {
"name": "reload",
"type": "boolean",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
}
},
"indexes": {},
- "foreignKeys": {
- "billing_workspace_id_workspace_id_fk": {
- "name": "billing_workspace_id_workspace_id_fk",
- "tableFrom": "billing",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
+ "foreignKeys": {},
"compositePrimaryKeys": {
"billing_workspace_id_id_pk": {
"name": "billing_workspace_id_id_pk",
@@ -90,74 +147,72 @@
}
},
"uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
+ "checkConstraint": {}
},
- "public.payment": {
+ "payment": {
"name": "payment",
- "schema": "",
"columns": {
"id": {
"name": "id",
"type": "varchar(30)",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"workspace_id": {
"name": "workspace_id",
"type": "varchar(30)",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"time_created": {
"name": "time_created",
- "type": "timestamp with time zone",
+ "type": "timestamp(3)",
"primaryKey": false,
"notNull": true,
- "default": "now()"
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "time_updated": {
+ "name": "time_updated",
+ "type": "timestamp(3)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)"
},
"time_deleted": {
"name": "time_deleted",
- "type": "timestamp with time zone",
+ "type": "timestamp(3)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"customer_id": {
"name": "customer_id",
"type": "varchar(255)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"payment_id": {
"name": "payment_id",
"type": "varchar(255)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"amount": {
"name": "amount",
"type": "bigint",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
}
},
"indexes": {},
- "foreignKeys": {
- "payment_workspace_id_workspace_id_fk": {
- "name": "payment_workspace_id_workspace_id_fk",
- "tableFrom": "payment",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
+ "foreignKeys": {},
"compositePrimaryKeys": {
"payment_workspace_id_id_pk": {
"name": "payment_workspace_id_id_pk",
@@ -168,107 +223,194 @@
}
},
"uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
+ "checkConstraint": {}
},
- "public.usage": {
+ "usage": {
"name": "usage",
- "schema": "",
"columns": {
"id": {
"name": "id",
"type": "varchar(30)",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"workspace_id": {
"name": "workspace_id",
"type": "varchar(30)",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"time_created": {
"name": "time_created",
- "type": "timestamp with time zone",
+ "type": "timestamp(3)",
"primaryKey": false,
"notNull": true,
- "default": "now()"
+ "autoincrement": false,
+ "default": "(now())"
},
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
+ "time_updated": {
+ "name": "time_updated",
+ "type": "timestamp(3)",
"primaryKey": false,
- "notNull": false
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)"
},
- "request_id": {
- "name": "request_id",
- "type": "varchar(255)",
+ "time_deleted": {
+ "name": "time_deleted",
+ "type": "timestamp(3)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"model": {
"name": "model",
"type": "varchar(255)",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"input_tokens": {
"name": "input_tokens",
- "type": "integer",
+ "type": "int",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"output_tokens": {
"name": "output_tokens",
- "type": "integer",
+ "type": "int",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"reasoning_tokens": {
"name": "reasoning_tokens",
- "type": "integer",
+ "type": "int",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"cache_read_tokens": {
"name": "cache_read_tokens",
- "type": "integer",
+ "type": "int",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"cache_write_tokens": {
"name": "cache_write_tokens",
- "type": "integer",
+ "type": "int",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"cost": {
"name": "cost",
"type": "bigint",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
}
},
"indexes": {},
- "foreignKeys": {
- "usage_workspace_id_workspace_id_fk": {
- "name": "usage_workspace_id_workspace_id_fk",
- "tableFrom": "usage",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "usage_workspace_id_id_pk": {
+ "name": "usage_workspace_id_id_pk",
+ "columns": [
+ "workspace_id",
"id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "key": {
+ "name": "key",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "time_created": {
+ "name": "time_created",
+ "type": "timestamp(3)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "time_updated": {
+ "name": "time_updated",
+ "type": "timestamp(3)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)"
+ },
+ "time_deleted": {
+ "name": "time_deleted",
+ "type": "timestamp(3)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "key": {
+ "name": "key",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "time_used": {
+ "name": "time_used",
+ "type": "timestamp(3)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "global_key": {
+ "name": "global_key",
+ "columns": [
+ "key"
],
- "onDelete": "no action",
- "onUpdate": "no action"
+ "isUnique": true
}
},
+ "foreignKeys": {},
"compositePrimaryKeys": {
- "usage_workspace_id_id_pk": {
- "name": "usage_workspace_id_id_pk",
+ "key_workspace_id_id_pk": {
+ "name": "key_workspace_id_id_pk",
"columns": [
"workspace_id",
"id"
@@ -276,102 +418,88 @@
}
},
"uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
+ "checkConstraint": {}
},
- "public.user": {
+ "user": {
"name": "user",
- "schema": "",
"columns": {
"id": {
"name": "id",
"type": "varchar(30)",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"workspace_id": {
"name": "workspace_id",
"type": "varchar(30)",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"time_created": {
"name": "time_created",
- "type": "timestamp with time zone",
+ "type": "timestamp(3)",
"primaryKey": false,
"notNull": true,
- "default": "now()"
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "time_updated": {
+ "name": "time_updated",
+ "type": "timestamp(3)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)"
},
"time_deleted": {
"name": "time_deleted",
- "type": "timestamp with time zone",
+ "type": "timestamp(3)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"email": {
"name": "email",
- "type": "text",
+ "type": "varchar(255)",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
- "notNull": true
+ "notNull": true,
+ "autoincrement": false
},
"time_seen": {
"name": "time_seen",
- "type": "timestamp with time zone",
+ "type": "timestamp(3)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"color": {
"name": "color",
- "type": "integer",
+ "type": "int",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
}
},
"indexes": {
"user_email": {
"name": "user_email",
"columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "email",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "user_workspace_id_workspace_id_fk": {
- "name": "user_workspace_id_workspace_id_fk",
- "tableFrom": "user",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
+ "workspace_id",
+ "email"
],
- "onDelete": "no action",
- "onUpdate": "no action"
+ "isUnique": true
}
},
+ "foreignKeys": {},
"compositePrimaryKeys": {
"user_workspace_id_id_pk": {
"name": "user_workspace_id_id_pk",
@@ -382,80 +510,86 @@
}
},
"uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
+ "checkConstraint": {}
},
- "public.workspace": {
+ "workspace": {
"name": "workspace",
- "schema": "",
"columns": {
"id": {
"name": "id",
"type": "varchar(30)",
- "primaryKey": true,
- "notNull": true
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
},
"slug": {
"name": "slug",
"type": "varchar(255)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
},
"time_created": {
"name": "time_created",
- "type": "timestamp with time zone",
+ "type": "timestamp(3)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "time_updated": {
+ "name": "time_updated",
+ "type": "timestamp(3)",
"primaryKey": false,
"notNull": true,
- "default": "now()"
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)"
},
"time_deleted": {
"name": "time_deleted",
- "type": "timestamp with time zone",
+ "type": "timestamp(3)",
"primaryKey": false,
- "notNull": false
+ "notNull": false,
+ "autoincrement": false
}
},
"indexes": {
"slug": {
"name": "slug",
"columns": [
- {
- "expression": "slug",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
+ "slug"
],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
+ "isUnique": true
}
},
"foreignKeys": {},
- "compositePrimaryKeys": {},
+ "compositePrimaryKeys": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
"uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
+ "checkConstraint": {}
}
},
- "enums": {},
- "schemas": {},
- "sequences": {},
- "roles": {},
- "policies": {},
"views": {},
"_meta": {
- "columns": {},
"schemas": {},
- "tables": {}
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "tables": {},
+ "indexes": {}
}
} \ No newline at end of file
diff --git a/cloud/core/migrations/meta/0001_snapshot.json b/cloud/core/migrations/meta/0001_snapshot.json
deleted file mode 100644
index 69d66ebc6..000000000
--- a/cloud/core/migrations/meta/0001_snapshot.json
+++ /dev/null
@@ -1,515 +0,0 @@
-{
- "id": "bf9e9084-4073-4ecb-8e56-5610816c9589",
- "prevId": "9b5cec8c-8b59-4d7a-bb5c-76ade1c83d6f",
- "version": "7",
- "dialect": "postgresql",
- "tables": {
- "public.account": {
- "name": "account",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "email": {
- "name": "email",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {
- "email": {
- "name": "email",
- "columns": [
- {
- "expression": "email",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.billing": {
- "name": "billing",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "customer_id": {
- "name": "customer_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "payment_method_id": {
- "name": "payment_method_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "payment_method_last4": {
- "name": "payment_method_last4",
- "type": "varchar(4)",
- "primaryKey": false,
- "notNull": false
- },
- "balance": {
- "name": "balance",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- },
- "reload": {
- "name": "reload",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "billing_workspace_id_workspace_id_fk": {
- "name": "billing_workspace_id_workspace_id_fk",
- "tableFrom": "billing",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "billing_workspace_id_id_pk": {
- "name": "billing_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.payment": {
- "name": "payment",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "customer_id": {
- "name": "customer_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "payment_id": {
- "name": "payment_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "amount": {
- "name": "amount",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {},
- "foreignKeys": {
- "payment_workspace_id_workspace_id_fk": {
- "name": "payment_workspace_id_workspace_id_fk",
- "tableFrom": "payment",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "payment_workspace_id_id_pk": {
- "name": "payment_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.usage": {
- "name": "usage",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "request_id": {
- "name": "request_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "model": {
- "name": "model",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- },
- "input_tokens": {
- "name": "input_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "output_tokens": {
- "name": "output_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "reasoning_tokens": {
- "name": "reasoning_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "cache_read_tokens": {
- "name": "cache_read_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "cache_write_tokens": {
- "name": "cache_write_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "cost": {
- "name": "cost",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {},
- "foreignKeys": {
- "usage_workspace_id_workspace_id_fk": {
- "name": "usage_workspace_id_workspace_id_fk",
- "tableFrom": "usage",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "usage_workspace_id_id_pk": {
- "name": "usage_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user": {
- "name": "user",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- },
- "time_seen": {
- "name": "time_seen",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "color": {
- "name": "color",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "user_email": {
- "name": "user_email",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "email",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "user_workspace_id_workspace_id_fk": {
- "name": "user_workspace_id_workspace_id_fk",
- "tableFrom": "user",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "user_workspace_id_id_pk": {
- "name": "user_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.workspace": {
- "name": "workspace",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": true,
- "notNull": true
- },
- "slug": {
- "name": "slug",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "name": {
- "name": "name",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "slug": {
- "name": "slug",
- "columns": [
- {
- "expression": "slug",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- }
- },
- "enums": {},
- "schemas": {},
- "sequences": {},
- "roles": {},
- "policies": {},
- "views": {},
- "_meta": {
- "columns": {},
- "schemas": {},
- "tables": {}
- }
-} \ No newline at end of file
diff --git a/cloud/core/migrations/meta/0002_snapshot.json b/cloud/core/migrations/meta/0002_snapshot.json
deleted file mode 100644
index 7d970ab02..000000000
--- a/cloud/core/migrations/meta/0002_snapshot.json
+++ /dev/null
@@ -1,615 +0,0 @@
-{
- "id": "351e4956-74e0-4282-a23b-02f1a73fa38c",
- "prevId": "bf9e9084-4073-4ecb-8e56-5610816c9589",
- "version": "7",
- "dialect": "postgresql",
- "tables": {
- "public.account": {
- "name": "account",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "email": {
- "name": "email",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {
- "email": {
- "name": "email",
- "columns": [
- {
- "expression": "email",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.billing": {
- "name": "billing",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "customer_id": {
- "name": "customer_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "payment_method_id": {
- "name": "payment_method_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "payment_method_last4": {
- "name": "payment_method_last4",
- "type": "varchar(4)",
- "primaryKey": false,
- "notNull": false
- },
- "balance": {
- "name": "balance",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- },
- "reload": {
- "name": "reload",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "billing_workspace_id_workspace_id_fk": {
- "name": "billing_workspace_id_workspace_id_fk",
- "tableFrom": "billing",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "billing_workspace_id_id_pk": {
- "name": "billing_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.payment": {
- "name": "payment",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "customer_id": {
- "name": "customer_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "payment_id": {
- "name": "payment_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "amount": {
- "name": "amount",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {},
- "foreignKeys": {
- "payment_workspace_id_workspace_id_fk": {
- "name": "payment_workspace_id_workspace_id_fk",
- "tableFrom": "payment",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "payment_workspace_id_id_pk": {
- "name": "payment_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.usage": {
- "name": "usage",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "request_id": {
- "name": "request_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "model": {
- "name": "model",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- },
- "input_tokens": {
- "name": "input_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "output_tokens": {
- "name": "output_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "reasoning_tokens": {
- "name": "reasoning_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "cache_read_tokens": {
- "name": "cache_read_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "cache_write_tokens": {
- "name": "cache_write_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "cost": {
- "name": "cost",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {},
- "foreignKeys": {
- "usage_workspace_id_workspace_id_fk": {
- "name": "usage_workspace_id_workspace_id_fk",
- "tableFrom": "usage",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "usage_workspace_id_id_pk": {
- "name": "usage_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.key": {
- "name": "key",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- },
- "time_used": {
- "name": "time_used",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "global_key": {
- "name": "global_key",
- "columns": [
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "key_workspace_id_workspace_id_fk": {
- "name": "key_workspace_id_workspace_id_fk",
- "tableFrom": "key",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "key_workspace_id_id_pk": {
- "name": "key_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user": {
- "name": "user",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- },
- "time_seen": {
- "name": "time_seen",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "color": {
- "name": "color",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "user_email": {
- "name": "user_email",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "email",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "user_workspace_id_workspace_id_fk": {
- "name": "user_workspace_id_workspace_id_fk",
- "tableFrom": "user",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "user_workspace_id_id_pk": {
- "name": "user_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.workspace": {
- "name": "workspace",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": true,
- "notNull": true
- },
- "slug": {
- "name": "slug",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "name": {
- "name": "name",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "slug": {
- "name": "slug",
- "columns": [
- {
- "expression": "slug",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- }
- },
- "enums": {},
- "schemas": {},
- "sequences": {},
- "roles": {},
- "policies": {},
- "views": {},
- "_meta": {
- "columns": {},
- "schemas": {},
- "tables": {}
- }
-} \ No newline at end of file
diff --git a/cloud/core/migrations/meta/0003_snapshot.json b/cloud/core/migrations/meta/0003_snapshot.json
deleted file mode 100644
index e1202ddbf..000000000
--- a/cloud/core/migrations/meta/0003_snapshot.json
+++ /dev/null
@@ -1,609 +0,0 @@
-{
- "id": "fa935883-9e51-4811-90c7-8967eefe458c",
- "prevId": "351e4956-74e0-4282-a23b-02f1a73fa38c",
- "version": "7",
- "dialect": "postgresql",
- "tables": {
- "public.account": {
- "name": "account",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "email": {
- "name": "email",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {
- "email": {
- "name": "email",
- "columns": [
- {
- "expression": "email",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.billing": {
- "name": "billing",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "customer_id": {
- "name": "customer_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "payment_method_id": {
- "name": "payment_method_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "payment_method_last4": {
- "name": "payment_method_last4",
- "type": "varchar(4)",
- "primaryKey": false,
- "notNull": false
- },
- "balance": {
- "name": "balance",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- },
- "reload": {
- "name": "reload",
- "type": "boolean",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "billing_workspace_id_workspace_id_fk": {
- "name": "billing_workspace_id_workspace_id_fk",
- "tableFrom": "billing",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "billing_workspace_id_id_pk": {
- "name": "billing_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.payment": {
- "name": "payment",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "customer_id": {
- "name": "customer_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "payment_id": {
- "name": "payment_id",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "amount": {
- "name": "amount",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {},
- "foreignKeys": {
- "payment_workspace_id_workspace_id_fk": {
- "name": "payment_workspace_id_workspace_id_fk",
- "tableFrom": "payment",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "payment_workspace_id_id_pk": {
- "name": "payment_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.usage": {
- "name": "usage",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "model": {
- "name": "model",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- },
- "input_tokens": {
- "name": "input_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "output_tokens": {
- "name": "output_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "reasoning_tokens": {
- "name": "reasoning_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "cache_read_tokens": {
- "name": "cache_read_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "cache_write_tokens": {
- "name": "cache_write_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "cost": {
- "name": "cost",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {},
- "foreignKeys": {
- "usage_workspace_id_workspace_id_fk": {
- "name": "usage_workspace_id_workspace_id_fk",
- "tableFrom": "usage",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "usage_workspace_id_id_pk": {
- "name": "usage_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.key": {
- "name": "key",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- },
- "time_used": {
- "name": "time_used",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "global_key": {
- "name": "global_key",
- "columns": [
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "key_workspace_id_workspace_id_fk": {
- "name": "key_workspace_id_workspace_id_fk",
- "tableFrom": "key",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "key_workspace_id_id_pk": {
- "name": "key_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user": {
- "name": "user",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "workspace_id": {
- "name": "workspace_id",
- "type": "varchar(30)",
- "primaryKey": false,
- "notNull": true
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": true
- },
- "time_seen": {
- "name": "time_seen",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "color": {
- "name": "color",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "user_email": {
- "name": "user_email",
- "columns": [
- {
- "expression": "workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "email",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "user_workspace_id_workspace_id_fk": {
- "name": "user_workspace_id_workspace_id_fk",
- "tableFrom": "user",
- "tableTo": "workspace",
- "columnsFrom": [
- "workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "user_workspace_id_id_pk": {
- "name": "user_workspace_id_id_pk",
- "columns": [
- "workspace_id",
- "id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.workspace": {
- "name": "workspace",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "varchar(30)",
- "primaryKey": true,
- "notNull": true
- },
- "slug": {
- "name": "slug",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "name": {
- "name": "name",
- "type": "varchar(255)",
- "primaryKey": false,
- "notNull": false
- },
- "time_created": {
- "name": "time_created",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "time_deleted": {
- "name": "time_deleted",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "slug": {
- "name": "slug",
- "columns": [
- {
- "expression": "slug",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- }
- },
- "enums": {},
- "schemas": {},
- "sequences": {},
- "roles": {},
- "policies": {},
- "views": {},
- "_meta": {
- "columns": {},
- "schemas": {},
- "tables": {}
- }
-} \ No newline at end of file
diff --git a/cloud/core/migrations/meta/_journal.json b/cloud/core/migrations/meta/_journal.json
index ceba11e26..6ff70c217 100644
--- a/cloud/core/migrations/meta/_journal.json
+++ b/cloud/core/migrations/meta/_journal.json
@@ -1,33 +1,12 @@
{
"version": "7",
- "dialect": "postgresql",
+ "dialect": "mysql",
"entries": [
{
"idx": 0,
- "version": "7",
- "when": 1754518198186,
- "tag": "0000_amused_mojo",
- "breakpoints": true
- },
- {
- "idx": 1,
- "version": "7",
- "when": 1754609655262,
- "tag": "0001_thankful_chat",
- "breakpoints": true
- },
- {
- "idx": 2,
- "version": "7",
- "when": 1754627626945,
- "tag": "0002_stale_jackal",
- "breakpoints": true
- },
- {
- "idx": 3,
- "version": "7",
- "when": 1754672464106,
- "tag": "0003_tranquil_spencer_smythe",
+ "version": "5",
+ "when": 1756796050935,
+ "tag": "0000_fluffy_raza",
"breakpoints": true
}
]