chore: initialize qiming workspace repository

This commit is contained in:
Codex
2026-05-29 14:22:48 +08:00
commit bfd67a0f2c
10750 changed files with 1885711 additions and 0 deletions

View File

@@ -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`)
);

View File

@@ -0,0 +1,967 @@
{
"version": "6",
"id": "aee779c5-db1d-4655-95ec-6451c18455be",
"prevIds": ["00000000-0000-0000-0000-000000000000"],
"dialect": "mysql",
"ddl": [
{
"name": "account",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "account",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "account",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "account",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "account",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "email",
"table": "account",
"entityType": "columns"
},
{
"name": "billing",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "billing",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "billing",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "billing",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "customer_id",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "payment_method_id",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(4)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "payment_method_last4",
"table": "billing",
"entityType": "columns"
},
{
"type": "bigint",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "balance",
"table": "billing",
"entityType": "columns"
},
{
"type": "boolean",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "reload",
"table": "billing",
"entityType": "columns"
},
{
"name": "payment",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "payment",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "payment",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "payment",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "payment",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "payment",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "customer_id",
"table": "payment",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "payment_id",
"table": "payment",
"entityType": "columns"
},
{
"type": "bigint",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "amount",
"table": "payment",
"entityType": "columns"
},
{
"name": "usage",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "usage",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "usage",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "usage",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "usage",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "usage",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "model",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "input_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "output_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "reasoning_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "cache_read_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "cache_write_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "bigint",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "cost",
"table": "usage",
"entityType": "columns"
},
{
"name": "key",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "key",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "key",
"entityType": "columns"
},
{
"type": "text",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "user_id",
"table": "key",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "name",
"table": "key",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "key",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_used",
"table": "key",
"entityType": "columns"
},
{
"name": "user",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "user",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "user",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "email",
"table": "user",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "name",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_seen",
"table": "user",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "color",
"table": "user",
"entityType": "columns"
},
{
"name": "workspace",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "workspace",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "slug",
"table": "workspace",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "name",
"table": "workspace",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "workspace",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "workspace",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "workspace",
"entityType": "columns"
},
{
"columns": [
{
"value": "email",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "email",
"table": "account",
"entityType": "indexes"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "billing",
"entityType": "pks"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "payment",
"entityType": "pks"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "usage",
"entityType": "pks"
},
{
"columns": [
{
"value": "key",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "global_key",
"table": "key",
"entityType": "indexes"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "key",
"entityType": "pks"
},
{
"columns": [
{
"value": "workspace_id",
"isExpression": false
},
{
"value": "email",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "user_email",
"table": "user",
"entityType": "indexes"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "user",
"entityType": "pks"
},
{
"columns": [
{
"value": "slug",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "slug",
"table": "workspace",
"entityType": "indexes"
},
{
"columns": ["id"],
"name": "PRIMARY",
"table": "workspace",
"entityType": "pks"
}
],
"renames": []
}

View File

@@ -0,0 +1,2 @@
ALTER TABLE `key` ADD `actor` json;--> statement-breakpoint
ALTER TABLE `key` DROP COLUMN `user_id`;

View File

@@ -0,0 +1,967 @@
{
"version": "6",
"id": "79b7ee25-1c1c-41ff-9bbf-754af257102b",
"prevIds": ["aee779c5-db1d-4655-95ec-6451c18455be"],
"dialect": "mysql",
"ddl": [
{
"name": "account",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "account",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "account",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "account",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "account",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "email",
"table": "account",
"entityType": "columns"
},
{
"name": "billing",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "billing",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "billing",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "billing",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "customer_id",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "payment_method_id",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(4)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "payment_method_last4",
"table": "billing",
"entityType": "columns"
},
{
"type": "bigint",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "balance",
"table": "billing",
"entityType": "columns"
},
{
"type": "boolean",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "reload",
"table": "billing",
"entityType": "columns"
},
{
"name": "payment",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "payment",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "payment",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "payment",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "payment",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "payment",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "customer_id",
"table": "payment",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "payment_id",
"table": "payment",
"entityType": "columns"
},
{
"type": "bigint",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "amount",
"table": "payment",
"entityType": "columns"
},
{
"name": "usage",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "usage",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "usage",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "usage",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "usage",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "usage",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "model",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "input_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "output_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "reasoning_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "cache_read_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "cache_write_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "bigint",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "cost",
"table": "usage",
"entityType": "columns"
},
{
"name": "key",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "key",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "key",
"entityType": "columns"
},
{
"type": "json",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "actor",
"table": "key",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "name",
"table": "key",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "key",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_used",
"table": "key",
"entityType": "columns"
},
{
"name": "user",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "user",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "user",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "email",
"table": "user",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "name",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_seen",
"table": "user",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "color",
"table": "user",
"entityType": "columns"
},
{
"name": "workspace",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "workspace",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "slug",
"table": "workspace",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "name",
"table": "workspace",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "workspace",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "workspace",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "workspace",
"entityType": "columns"
},
{
"columns": [
{
"value": "email",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "email",
"table": "account",
"entityType": "indexes"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "billing",
"entityType": "pks"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "payment",
"entityType": "pks"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "usage",
"entityType": "pks"
},
{
"columns": [
{
"value": "key",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "global_key",
"table": "key",
"entityType": "indexes"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "key",
"entityType": "pks"
},
{
"columns": [
{
"value": "workspace_id",
"isExpression": false
},
{
"value": "email",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "user_email",
"table": "user",
"entityType": "indexes"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "user",
"entityType": "pks"
},
{
"columns": [
{
"value": "slug",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "slug",
"table": "workspace",
"entityType": "indexes"
},
{
"columns": ["id"],
"name": "PRIMARY",
"table": "workspace",
"entityType": "pks"
}
],
"renames": []
}

View File

@@ -0,0 +1 @@
ALTER TABLE `key` ADD `old_name` varchar(255);

View File

@@ -0,0 +1,981 @@
{
"version": "6",
"id": "9f51ef52-31ac-4ace-8b6d-39b35efe9c81",
"prevIds": ["79b7ee25-1c1c-41ff-9bbf-754af257102b"],
"dialect": "mysql",
"ddl": [
{
"name": "account",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "account",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "account",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "account",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "account",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "email",
"table": "account",
"entityType": "columns"
},
{
"name": "billing",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "billing",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "billing",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "billing",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "customer_id",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "payment_method_id",
"table": "billing",
"entityType": "columns"
},
{
"type": "varchar(4)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "payment_method_last4",
"table": "billing",
"entityType": "columns"
},
{
"type": "bigint",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "balance",
"table": "billing",
"entityType": "columns"
},
{
"type": "boolean",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "reload",
"table": "billing",
"entityType": "columns"
},
{
"name": "payment",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "payment",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "payment",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "payment",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "payment",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "payment",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "customer_id",
"table": "payment",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "payment_id",
"table": "payment",
"entityType": "columns"
},
{
"type": "bigint",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "amount",
"table": "payment",
"entityType": "columns"
},
{
"name": "usage",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "usage",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "usage",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "usage",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "usage",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "usage",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "model",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "input_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "output_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "reasoning_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "cache_read_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "cache_write_tokens",
"table": "usage",
"entityType": "columns"
},
{
"type": "bigint",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "cost",
"table": "usage",
"entityType": "columns"
},
{
"name": "key",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "key",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "key",
"entityType": "columns"
},
{
"type": "json",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "actor",
"table": "key",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "name",
"table": "key",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "old_name",
"table": "key",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "key",
"table": "key",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_used",
"table": "key",
"entityType": "columns"
},
{
"name": "user",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "user",
"entityType": "columns"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "workspace_id",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "user",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "email",
"table": "user",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "name",
"table": "user",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_seen",
"table": "user",
"entityType": "columns"
},
{
"type": "int",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "color",
"table": "user",
"entityType": "columns"
},
{
"name": "workspace",
"entityType": "tables"
},
{
"type": "varchar(30)",
"notNull": true,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "id",
"table": "workspace",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "slug",
"table": "workspace",
"entityType": "columns"
},
{
"type": "varchar(255)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "name",
"table": "workspace",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "(now())",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_created",
"table": "workspace",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": true,
"autoIncrement": false,
"default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)",
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_updated",
"table": "workspace",
"entityType": "columns"
},
{
"type": "timestamp(3)",
"notNull": false,
"autoIncrement": false,
"default": null,
"onUpdateNow": false,
"onUpdateNowFsp": null,
"charSet": null,
"collation": null,
"generated": null,
"name": "time_deleted",
"table": "workspace",
"entityType": "columns"
},
{
"columns": [
{
"value": "email",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "email",
"table": "account",
"entityType": "indexes"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "billing",
"entityType": "pks"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "payment",
"entityType": "pks"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "usage",
"entityType": "pks"
},
{
"columns": [
{
"value": "key",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "global_key",
"table": "key",
"entityType": "indexes"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "key",
"entityType": "pks"
},
{
"columns": [
{
"value": "workspace_id",
"isExpression": false
},
{
"value": "email",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "user_email",
"table": "user",
"entityType": "indexes"
},
{
"columns": ["workspace_id", "id"],
"name": "PRIMARY",
"table": "user",
"entityType": "pks"
},
{
"columns": [
{
"value": "slug",
"isExpression": false
}
],
"isUnique": true,
"using": null,
"algorithm": null,
"lock": null,
"nameExplicit": true,
"name": "slug",
"table": "workspace",
"entityType": "indexes"
},
{
"columns": ["id"],
"name": "PRIMARY",
"table": "workspace",
"entityType": "pks"
}
],
"renames": []
}

View File

@@ -0,0 +1 @@
ALTER TABLE `key` ADD CONSTRAINT `name` UNIQUE(`workspace_id`,`name`);

View File

@@ -0,0 +1 @@
ALTER TABLE `usage` ADD `provider` varchar(255);

View File

@@ -0,0 +1 @@
ALTER TABLE `usage` MODIFY COLUMN `provider` varchar(255) NOT NULL;

View File

@@ -0,0 +1,2 @@
ALTER TABLE `usage` ADD `cache_write_5m_tokens` int;--> statement-breakpoint
ALTER TABLE `usage` ADD `cache_write_1h_tokens` int;

View File

@@ -0,0 +1 @@
ALTER TABLE `usage` DROP COLUMN `cache_write_tokens`;

View File

@@ -0,0 +1 @@
ALTER TABLE `billing` ADD `time_reload_locked_till` timestamp(3);

View File

@@ -0,0 +1 @@
ALTER TABLE `payment` ADD `error` varchar(255);

View File

@@ -0,0 +1 @@
ALTER TABLE `billing` ADD CONSTRAINT `global_customer_id` UNIQUE(`customer_id`);

View File

@@ -0,0 +1,3 @@
ALTER TABLE `billing` ADD `last_error` varchar(255);--> statement-breakpoint
ALTER TABLE `billing` ADD `time_last_error` timestamp(3);--> statement-breakpoint
ALTER TABLE `payment` DROP COLUMN `error`;

View File

@@ -0,0 +1,3 @@
ALTER TABLE `billing` ADD `monthly_limit` int;--> statement-breakpoint
ALTER TABLE `billing` ADD `monthly_usage` bigint;--> statement-breakpoint
ALTER TABLE `billing` ADD `time_monthly_usage_updated` timestamp(3);

View File

@@ -0,0 +1,2 @@
ALTER TABLE `billing` RENAME COLUMN `last_error` TO `reload_error`;--> statement-breakpoint
ALTER TABLE `billing` RENAME COLUMN `time_last_error` TO `time_reload_error`;

View File

@@ -0,0 +1 @@
ALTER TABLE `workspace` ADD `data_share` boolean;

View File

@@ -0,0 +1 @@
ALTER TABLE `workspace` DROP COLUMN `data_share`;

View File

@@ -0,0 +1 @@
ALTER TABLE `payment` ADD `time_refunded` timestamp(3);

View File

@@ -0,0 +1 @@
ALTER TABLE `payment` ADD `invoice_id` varchar(255);

View File

@@ -0,0 +1,2 @@
ALTER TABLE `user` ADD `time_joined` timestamp(3);--> statement-breakpoint
ALTER TABLE `user` ADD `role` enum('admin','member');

View File

@@ -0,0 +1 @@
ALTER TABLE `user` MODIFY COLUMN `role` enum('admin','member') NOT NULL;

View File

@@ -0,0 +1 @@
ALTER TABLE `user` DROP COLUMN `time_joined`;

View File

@@ -0,0 +1,2 @@
ALTER TABLE `user` MODIFY COLUMN `email` varchar(255);--> statement-breakpoint
ALTER TABLE `user` ADD `old_email` varchar(255);

View File

@@ -0,0 +1,3 @@
ALTER TABLE `user` ADD `account_id` varchar(30);--> statement-breakpoint
ALTER TABLE `user` ADD `old_account_id` varchar(30);--> statement-breakpoint
ALTER TABLE `user` ADD CONSTRAINT `user_account_id` UNIQUE(`workspace_id`,`account_id`);

View File

@@ -0,0 +1,2 @@
CREATE INDEX `global_account_id` ON `user` (`account_id`);--> statement-breakpoint
CREATE INDEX `global_email` ON `user` (`email`);

View File

@@ -0,0 +1,2 @@
ALTER TABLE `user` DROP COLUMN `old_account_id`;--> statement-breakpoint
ALTER TABLE `user` DROP COLUMN `old_email`;

View File

@@ -0,0 +1 @@
ALTER TABLE `key` ADD `user_id` varchar(30);

View File

@@ -0,0 +1 @@
ALTER TABLE `key` DROP INDEX `name`;

View File

@@ -0,0 +1,3 @@
ALTER TABLE `key` MODIFY COLUMN `user_id` varchar(30) NOT NULL;--> statement-breakpoint
ALTER TABLE `key` DROP COLUMN `actor`;--> statement-breakpoint
ALTER TABLE `key` DROP COLUMN `old_name`;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
ALTER TABLE `workspace` MODIFY COLUMN `name` varchar(255) NOT NULL;

View File

@@ -0,0 +1,3 @@
ALTER TABLE `user` ADD `monthly_limit` int;--> statement-breakpoint
ALTER TABLE `user` ADD `monthly_usage` bigint;--> statement-breakpoint
ALTER TABLE `user` ADD `time_monthly_usage_updated` timestamp(3);

View File

@@ -0,0 +1,10 @@
CREATE TABLE `model` (
`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(64) NOT NULL,
CONSTRAINT `model_workspace_id_id_pk` PRIMARY KEY(`workspace_id`,`id`),
CONSTRAINT `model_workspace_model` UNIQUE(`workspace_id`,`model`)
);

View File

@@ -0,0 +1,11 @@
CREATE TABLE `provider` (
`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),
`provider` varchar(64) NOT NULL,
`credentials` text NOT NULL,
CONSTRAINT `provider_workspace_id_id_pk` PRIMARY KEY(`workspace_id`,`id`),
CONSTRAINT `workspace_provider` UNIQUE(`workspace_id`,`provider`)
);

View File

@@ -0,0 +1 @@
ALTER TABLE `usage` ADD `key_id` varchar(30);

View File

@@ -0,0 +1 @@
ALTER TABLE `billing` ADD `payment_method_type` varchar(32);

View File

@@ -0,0 +1,10 @@
CREATE TABLE `auth` (
`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),
`provider` enum('email','github','google') NOT NULL,
`subject` varchar(255) NOT NULL,
`account_id` varchar(30) NOT NULL,
CONSTRAINT `provider` UNIQUE(`provider`,`subject`)
);

View File

@@ -0,0 +1,3 @@
ALTER TABLE `account` DROP INDEX `email`;--> statement-breakpoint
CREATE INDEX `account_id` ON `auth` (`account_id`);--> statement-breakpoint
ALTER TABLE `account` DROP COLUMN `email`;

View File

@@ -0,0 +1,2 @@
ALTER TABLE `account` ADD PRIMARY KEY(`id`);--> statement-breakpoint
ALTER TABLE `auth` ADD PRIMARY KEY(`id`);

View File

@@ -0,0 +1,2 @@
ALTER TABLE `billing` ADD `reload_trigger` int;--> statement-breakpoint
ALTER TABLE `billing` ADD `reload_amount` int;

View File

@@ -0,0 +1,8 @@
CREATE TABLE `ip` (
`ip` varchar(45) 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),
`usage` int,
CONSTRAINT `ip_ip_pk` PRIMARY KEY(`ip`)
);

View File

@@ -0,0 +1,12 @@
CREATE TABLE `benchmark` (
`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(64) NOT NULL,
`agent` varchar(64) NOT NULL,
`result` mediumtext NOT NULL,
CONSTRAINT `benchmark_id_pk` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE INDEX `time_created` ON `benchmark` (`time_created`);

View File

@@ -0,0 +1 @@
CREATE INDEX `usage_time_created` ON `usage` (`workspace_id`,`time_created`);

View File

@@ -0,0 +1,6 @@
CREATE TABLE `ip_rate_limit` (
`ip` varchar(45) NOT NULL,
`interval` varchar(10) NOT NULL,
`count` int NOT NULL,
CONSTRAINT `ip_rate_limit_ip_interval_pk` PRIMARY KEY(`ip`,`interval`)
);

View File

@@ -0,0 +1,7 @@
ALTER TABLE `billing` ADD `subscription_id` varchar(28);--> statement-breakpoint
ALTER TABLE `usage` ADD `data` json;--> statement-breakpoint
ALTER TABLE `user` ADD `time_subscribed` timestamp(3);--> statement-breakpoint
ALTER TABLE `user` ADD `sub_recent_usage` bigint;--> statement-breakpoint
ALTER TABLE `user` ADD `sub_monthly_usage` bigint;--> statement-breakpoint
ALTER TABLE `user` ADD `sub_time_recent_usage_updated` timestamp(3);--> statement-breakpoint
ALTER TABLE `user` ADD `sub_time_monthly_usage_updated` timestamp(3);

View File

@@ -0,0 +1,2 @@
ALTER TABLE `user` RENAME COLUMN `sub_recent_usage` TO `sub_interval_usage`;--> statement-breakpoint
ALTER TABLE `user` RENAME COLUMN `sub_time_recent_usage_updated` TO `sub_time_interval_usage_updated`;

View File

@@ -0,0 +1 @@
ALTER TABLE `usage` RENAME COLUMN `data` TO `enrichment`;

View File

@@ -0,0 +1 @@
ALTER TABLE `billing` ADD CONSTRAINT `global_subscription_id` UNIQUE(`subscription_id`);

View File

@@ -0,0 +1,13 @@
CREATE TABLE `subscription` (
`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` varchar(30) NOT NULL,
`rolling_usage` bigint,
`fixed_usage` bigint,
`time_rolling_updated` timestamp(3),
`time_fixed_updated` timestamp(3),
CONSTRAINT `subscription_workspace_id_id_pk` PRIMARY KEY(`workspace_id`,`id`)
);

View File

@@ -0,0 +1,6 @@
CREATE INDEX `workspace_user_id` ON `subscription` (`workspace_id`,`user_id`);--> statement-breakpoint
ALTER TABLE `user` DROP COLUMN `time_subscribed`;--> statement-breakpoint
ALTER TABLE `user` DROP COLUMN `sub_interval_usage`;--> statement-breakpoint
ALTER TABLE `user` DROP COLUMN `sub_monthly_usage`;--> statement-breakpoint
ALTER TABLE `user` DROP COLUMN `sub_time_interval_usage_updated`;--> statement-breakpoint
ALTER TABLE `user` DROP COLUMN `sub_time_monthly_usage_updated`;

View File

@@ -0,0 +1,2 @@
DROP INDEX `workspace_user_id` ON `subscription`;--> statement-breakpoint
ALTER TABLE `subscription` ADD CONSTRAINT `workspace_user_id` UNIQUE(`workspace_id`,`user_id`);

View File

@@ -0,0 +1 @@
ALTER TABLE `billing` ADD `subscription_coupon_id` varchar(28);

Some files were not shown because too many files have changed in this diff Show More