mirror of
https://github.com/certd/certd.git
synced 2026-07-20 14:27:31 +08:00
build: 数据库迁移脚本同步
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
ALTER TABLE cd_access ADD COLUMN subtype varchar(100);
|
||||
CREATE INDEX "index_access_subtype" ON "cd_access" ("subtype");
|
||||
|
||||
CREATE TABLE "cd_dns_persist_record"
|
||||
(
|
||||
"id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY NOT NULL,
|
||||
"user_id" bigint NOT NULL,
|
||||
"project_id" bigint,
|
||||
"domain" varchar(255) NOT NULL,
|
||||
"main_domain" varchar(255) NOT NULL,
|
||||
"ca_type" varchar(50) NOT NULL,
|
||||
"acme_account_access_id" bigint NOT NULL,
|
||||
"account_uri" varchar(512) NOT NULL,
|
||||
"host_record" varchar(255) NOT NULL,
|
||||
"record_value" text NOT NULL,
|
||||
"policy" varchar(50),
|
||||
"persist_until" bigint,
|
||||
"status" varchar(50) NOT NULL DEFAULT 'pending',
|
||||
"dns_provider_type" varchar(50),
|
||||
"dns_provider_access" bigint,
|
||||
"record_res" text,
|
||||
"disabled" bigint NOT NULL DEFAULT 0,
|
||||
"create_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
|
||||
"update_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
|
||||
);
|
||||
|
||||
CREATE INDEX "index_dns_persist_user_id" ON "cd_dns_persist_record" ("user_id");
|
||||
CREATE INDEX "index_dns_persist_project_id" ON "cd_dns_persist_record" ("project_id");
|
||||
CREATE INDEX "index_dns_persist_domain" ON "cd_dns_persist_record" ("domain");
|
||||
CREATE INDEX "index_dns_persist_main_domain" ON "cd_dns_persist_record" ("main_domain");
|
||||
CREATE INDEX "index_dns_persist_account" ON "cd_dns_persist_record" ("acme_account_access_id");
|
||||
@@ -0,0 +1,29 @@
|
||||
-- 激活码表
|
||||
CREATE TABLE "cd_product_activation_code"
|
||||
(
|
||||
"id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY NOT NULL,
|
||||
"code" varchar(50) NOT NULL,
|
||||
"product_id" bigint NOT NULL,
|
||||
"duration" bigint NOT NULL,
|
||||
"batch_no" varchar(50) NOT NULL DEFAULT '',
|
||||
"status" varchar(20) NOT NULL DEFAULT 'unused',
|
||||
"used_user_id" bigint,
|
||||
"used_time" bigint,
|
||||
"expire_time" bigint,
|
||||
"disabled_time" bigint,
|
||||
"exported" bigint NOT NULL DEFAULT 0,
|
||||
"export_time" bigint,
|
||||
"remark" varchar(500) NOT NULL DEFAULT '',
|
||||
"create_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
|
||||
"update_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX "index_activation_code_code" ON "cd_product_activation_code" ("code");
|
||||
CREATE INDEX "index_activation_code_batch_no" ON "cd_product_activation_code" ("batch_no");
|
||||
CREATE INDEX "index_activation_code_status" ON "cd_product_activation_code" ("status");
|
||||
CREATE INDEX "index_activation_code_expire_time" ON "cd_product_activation_code" ("expire_time");
|
||||
CREATE INDEX "index_activation_code_exported" ON "cd_product_activation_code" ("exported");
|
||||
|
||||
-- cd_user_suite 增加激活码来源追溯
|
||||
ALTER TABLE "cd_user_suite"
|
||||
ADD COLUMN "activation_code_id" bigint;
|
||||
@@ -0,0 +1,16 @@
|
||||
CREATE TABLE "cd_cert_apply_template"
|
||||
(
|
||||
"id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY NOT NULL,
|
||||
"user_id" bigint NOT NULL,
|
||||
"project_id" bigint NULL,
|
||||
"name" varchar(100) NOT NULL,
|
||||
"content" text NOT NULL,
|
||||
"is_default" boolean NOT NULL DEFAULT (false),
|
||||
"disabled" boolean NOT NULL DEFAULT (false),
|
||||
"create_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
|
||||
"update_time" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
|
||||
);
|
||||
|
||||
CREATE INDEX "index_cert_apply_template_user_id" ON "cd_cert_apply_template" ("user_id");
|
||||
CREATE INDEX "index_cert_apply_template_project_id" ON "cd_cert_apply_template" ("project_id");
|
||||
CREATE INDEX "index_cert_apply_template_default" ON "cd_cert_apply_template" ("user_id", "project_id", "is_default");
|
||||
Reference in New Issue
Block a user