AGSSbackend/script.sql

33 lines
1.1 KiB
MySQL
Raw Normal View History

2025-07-15 22:21:06 +08:00
START TRANSACTION;
DROP TABLE "Dictionaries";
2025-07-15 22:21:06 +08:00
CREATE TABLE "DictItems" (
"Uuid" uuid NOT NULL,
parentid uuid,
parentvalue text,
label character varying(100) NOT NULL,
"LabelEn" character varying(100),
"Remark" character varying(500),
value character varying(50) NOT NULL,
tag character varying(500),
createtime timestamp with time zone NOT NULL,
"CreateUserId" uuid NOT NULL,
CONSTRAINT "PK_DictItems" PRIMARY KEY ("Uuid"),
CONSTRAINT "CK_TopLevelItems" CHECK (ParentId IS NULL OR (Tag IS NOT NULL AND ParentValue IS NOT NULL)),
CONSTRAINT "FK_DictItems_DictItems_parentid" FOREIGN KEY (parentid) REFERENCES "DictItems" ("Uuid") ON DELETE CASCADE
);
2025-07-15 22:21:06 +08:00
CREATE INDEX "IX_DictItems_parentid" ON "DictItems" (parentid);
2025-07-15 22:21:06 +08:00
CREATE INDEX "IX_DictItems_parentvalue" ON "DictItems" (parentvalue);
2025-07-15 22:21:06 +08:00
CREATE INDEX "IX_DictItems_tag" ON "DictItems" (tag);
2025-07-15 22:21:06 +08:00
CREATE INDEX "IX_DictItems_value" ON "DictItems" (value);
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
2025-07-15 22:21:06 +08:00
VALUES ('20250715135627_dic1', '9.0.6');
2025-07-08 23:08:15 +08:00
COMMIT;