diff --git a/schema/mysql-changes/upgrade_21.sql b/schema/mysql-changes/upgrade_21.sql new file mode 100644 index 00000000..7c72b868 --- /dev/null +++ b/schema/mysql-changes/upgrade_21.sql @@ -0,0 +1,15 @@ +DROP TABLE director_datalist_value; + +CREATE TABLE director_datalist_entry ( + list_id INT(10) UNSIGNED NOT NULL, + entry_name VARCHAR(255) DEFAULT NULL, + entry_value TEXT DEFAULT NULL, + format enum ('string', 'expression', 'json'), + PRIMARY KEY (list_id, entry_name), + CONSTRAINT director_datalist_value_datalist + FOREIGN KEY datalist (list_id) + REFERENCES director_datalist (id) + ON DELETE CASCADE + ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + diff --git a/schema/mysql.sql b/schema/mysql.sql index 9b97a1f4..ad7569f7 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -100,12 +100,12 @@ CREATE TABLE director_datalist ( UNIQUE KEY list_name (list_name) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE director_datalist_value ( +CREATE TABLE director_datalist_entry ( list_id INT(10) UNSIGNED NOT NULL, - value_name VARCHAR(255) DEFAULT NULL, - value_expression TEXT DEFAULT NULL, + entry_name VARCHAR(255) DEFAULT NULL, + entry_value TEXT DEFAULT NULL, format enum ('string', 'expression', 'json'), - PRIMARY KEY (list_id, value_name), + PRIMARY KEY (list_id, entry_name), CONSTRAINT director_datalist_value_datalist FOREIGN KEY datalist (list_id) REFERENCES director_datalist (id) diff --git a/schema/pgsql-changes/upgrade_21.sql b/schema/pgsql-changes/upgrade_21.sql new file mode 100644 index 00000000..1a4fc5a6 --- /dev/null +++ b/schema/pgsql-changes/upgrade_21.sql @@ -0,0 +1,17 @@ +DROP TABLE director_datalist_value; + +CREATE TABLE director_datalist_entry ( + list_id integer NOT NULL, + entry_name character varying(255) DEFAULT NULL, + entry_value text DEFAULT NULL, + format enum_property_format, + PRIMARY KEY (list_id, entry_name), + CONSTRAINT director_datalist_entry_datalist + FOREIGN KEY (list_id) + REFERENCES director_datalist (id) + ON DELETE CASCADE + ON UPDATE CASCADE +); + +CREATE INDEX datalist_entry_datalist ON director_datalist_entry (list_id); + diff --git a/schema/pgsql.sql b/schema/pgsql.sql index c5c7dee8..6ba9ad16 100644 --- a/schema/pgsql.sql +++ b/schema/pgsql.sql @@ -134,20 +134,20 @@ CREATE TABLE director_datalist ( CREATE UNIQUE INDEX datalist_list_name ON director_datalist (list_name); -CREATE TABLE director_datalist_value ( +CREATE TABLE director_datalist_entry ( list_id integer NOT NULL, - value_name character varying(255) DEFAULT NULL, - value_expression text DEFAULT NULL, + entry_name character varying(255) DEFAULT NULL, + entry_value text DEFAULT NULL, format enum_property_format, - PRIMARY KEY (list_id, value_name), - CONSTRAINT director_datalist_value_datalist + PRIMARY KEY (list_id, entry_name), + CONSTRAINT director_datalist_entry_datalist FOREIGN KEY (list_id) REFERENCES director_datalist (id) ON DELETE CASCADE ON UPDATE CASCADE ); -CREATE INDEX datalist_value_datalist ON director_datalist_value (list_id); +CREATE INDEX datalist_entry_datalist ON director_datalist_entry (list_id); CREATE TABLE director_datatype (