From 52c6659f9f50844ccb590be61535b87ba6e4893e Mon Sep 17 00:00:00 2001 From: Eike Kettner Date: Wed, 25 Nov 2020 19:28:54 +0100 Subject: [PATCH] Add missing schema migrations for custom fields --- .../migration/h2/V1.13.0__custom_fields.sql | 20 +++++++++++++++++++ .../mariadb/V1.13.0__custom_fields.sql | 20 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 modules/store/src/main/resources/db/migration/h2/V1.13.0__custom_fields.sql create mode 100644 modules/store/src/main/resources/db/migration/mariadb/V1.13.0__custom_fields.sql diff --git a/modules/store/src/main/resources/db/migration/h2/V1.13.0__custom_fields.sql b/modules/store/src/main/resources/db/migration/h2/V1.13.0__custom_fields.sql new file mode 100644 index 00000000..708989bf --- /dev/null +++ b/modules/store/src/main/resources/db/migration/h2/V1.13.0__custom_fields.sql @@ -0,0 +1,20 @@ +CREATE TABLE "custom_field" ( + "id" varchar(254) not null primary key, + "name" varchar(254) not null, + "label" varchar(254), + "cid" varchar(254) not null, + "ftype" varchar(100) not null, + "created" timestamp not null, + foreign key ("cid") references "collective"("cid"), + unique ("cid", "name") +); + +CREATE TABLE "custom_field_value" ( + "id" varchar(254) not null primary key, + "item_id" varchar(254) not null, + "field" varchar(254) not null, + "field_value" varchar(300) not null, + foreign key ("item_id") references "item"("itemid"), + foreign key ("field") references "custom_field"("id"), + unique ("item_id", "field") +) diff --git a/modules/store/src/main/resources/db/migration/mariadb/V1.13.0__custom_fields.sql b/modules/store/src/main/resources/db/migration/mariadb/V1.13.0__custom_fields.sql new file mode 100644 index 00000000..413e8f81 --- /dev/null +++ b/modules/store/src/main/resources/db/migration/mariadb/V1.13.0__custom_fields.sql @@ -0,0 +1,20 @@ +CREATE TABLE `custom_field` ( + `id` varchar(254) not null primary key, + `name` varchar(254) not null, + `label` varchar(254), + `cid` varchar(254) not null, + `ftype` varchar(100) not null, + `created` timestamp not null, + foreign key (`cid`) references `collective`(`cid`), + unique (`cid`, `name`) +); + +CREATE TABLE `custom_field_value` ( + `id` varchar(254) not null primary key, + `item_id` varchar(254) not null, + `field` varchar(254) not null, + `field_value` varchar(300) not null, + foreign key (`item_id`) references `item`(`itemid`), + foreign key (`field`) references `custom_field`(`id`), + unique (`item_id`, `field`) +)