chore: 数据库同步

This commit is contained in:
xiaojunnuo
2025-09-14 00:40:38 +08:00
parent 67bd1cdcd9
commit 37f1f53b56
6 changed files with 36 additions and 4 deletions

View File

@@ -32,10 +32,10 @@
"@aws-sdk/s3-request-presigner": "^3.535.0",
"@certd/vue-js-cron-light": "^4.0.14",
"@ctrl/tinycolor": "^4.1.0",
"@fast-crud/fast-crud": "^1.25.13",
"@fast-crud/fast-extends": "^1.25.13",
"@fast-crud/ui-antdv4": "^1.25.13",
"@fast-crud/ui-interface": "^1.25.13",
"@fast-crud/fast-crud": "^1.26.6",
"@fast-crud/fast-extends": "^1.26.6",
"@fast-crud/ui-antdv4": "^1.26.6",
"@fast-crud/ui-interface": "^1.26.6",
"@iconify/tailwind": "^1.2.0",
"@iconify/vue": "^4.1.1",
"@manypkg/get-packages": "^2.2.2",

View File

@@ -0,0 +1,2 @@
ALTER TABLE cd_cert_info ADD COLUMN effective_time bigint;
ALTER TABLE cd_site_info ADD COLUMN cert_effective_time bigint;

View File

@@ -0,0 +1,13 @@
CREATE TABLE `cd_addon` (
`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL,
`user_id` bigint NOT NULL,
`name` varchar(100) NOT NULL,
`type` varchar(100) NOT NULL,
`addon_type` varchar(100) NOT NULL,
`is_default` boolean NOT NULL DEFAULT false,
`is_system` boolean NOT NULL DEFAULT false,
`setting` longtext,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);

View File

@@ -0,0 +1,2 @@
ALTER TABLE cd_cert_info ADD COLUMN effective_time bigint;
ALTER TABLE cd_site_info ADD COLUMN cert_effective_time bigint;

View File

@@ -0,0 +1,13 @@
CREATE TABLE "cd_addon" (
"id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY NOT NULL,
"user_id" bigint NOT NULL,
"name" varchar(100) NOT NULL,
"type" varchar(100) NOT NULL,
"addon_type" varchar(100) NOT NULL,
"is_default" boolean NOT NULL DEFAULT (false),
"is_system" boolean NOT NULL DEFAULT (false),
"setting" text,
"create_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
"update_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
);

View File

@@ -39,6 +39,7 @@ function transformPG() {
pgSql = pgSql.replaceAll(/boolean DEFAULT \(0\)/g, 'boolean DEFAULT (false)');
pgSql = pgSql.replaceAll(/boolean.*NOT NULL DEFAULT \(0\)/g, 'boolean NOT NULL DEFAULT (false)');
pgSql = pgSql.replaceAll(/integer/g, 'bigint');
pgSql = pgSql.replaceAll(/INTEGER/g, 'bigint');
pgSql = pgSql.replaceAll(/last_insert_rowid\(\)/g, 'LASTVAL()');
fs.writeFileSync(`./migration-pg/${notFile}`, pgSql);
}
@@ -66,6 +67,7 @@ function transformMysql() {
//DEFAULT (xxx) 替换成 DEFAULT xxx
pgSql = pgSql.replaceAll(/DEFAULT \(([^)]*)\)/g, 'DEFAULT $1');
pgSql = pgSql.replaceAll(/integer/g, 'bigint');
pgSql = pgSql.replaceAll(/INTEGER/g, 'bigint');
pgSql = pgSql.replaceAll(/last_insert_rowid\(\)/g, 'LAST_INSERT_ID()');
//text 改成longtext
pgSql = pgSql.replaceAll(/text/g, 'longtext');