Commit 7dac6843 authored by Volker Krause's avatar Volker Krause
Browse files

Fold the schema UUID change into the intial table creation in the schema

This allows us to make it NOT NULL UNIQUE even on sqlite, so let's do
this while we can still break compatibility.
parent 363ca9a5
......@@ -32,6 +32,9 @@
\li A targeting expression. Only surveys where this expression evaluates to \c true
for a specific user are presented. The targeting expression is optional, if it is
not set, \c true is implied, ie. the survey is considered for all users.
\li An internal globally unique id. This is used to ensure a user is not asked to take
the same survey twice. Therefore you should not delete and recreate surveys unless
you want to reset the unique id.
\endlist
\section1 Targeting Expressions
......
......@@ -14,9 +14,9 @@
{
"version": 3,
"sqlite": ["CREATE TABLE tbl_survey (col_id INTEGER PRIMARY KEY AUTOINCREMENT, col_product_id INTEGER REFERENCES tbl_product (col_id) ON DELETE CASCADE, col_name VARCHAR, col_url VARCHAR NOT NULL, col_active INTEGER DEFAULT 0)" ],
"mysql": ["CREATE TABLE tbl_survey (col_id INTEGER PRIMARY KEY AUTO_INCREMENT, col_product_id INTEGER REFERENCES tbl_product (col_id) ON DELETE CASCADE, col_name VARCHAR(255), col_url VARCHAR(255) NOT NULL, col_active BOOLEAN DEFAULT FALSE)" ],
"pgsql": ["CREATE TABLE tbl_survey (col_id SERIAL PRIMARY KEY, col_product_id INTEGER REFERENCES tbl_product (col_id) ON DELETE CASCADE, col_name VARCHAR, col_url VARCHAR NOT NULL, col_active BOOLEAN DEFAULT FALSE)" ]
"sqlite": ["CREATE TABLE tbl_survey (col_id INTEGER PRIMARY KEY AUTOINCREMENT, col_product_id INTEGER REFERENCES tbl_product (col_id) ON DELETE CASCADE, col_name VARCHAR, col_url VARCHAR NOT NULL, col_active INTEGER DEFAULT 0, col_uuid VARCHAR(40) UNIQUE NOT NULL)" ],
"mysql": ["CREATE TABLE tbl_survey (col_id INTEGER PRIMARY KEY AUTO_INCREMENT, col_product_id INTEGER REFERENCES tbl_product (col_id) ON DELETE CASCADE, col_name VARCHAR(255), col_url VARCHAR(255) NOT NULL, col_active BOOLEAN DEFAULT FALSE, col_uuid VARCHAR(40) UNIQUE NOT NULL)" ],
"pgsql": ["CREATE TABLE tbl_survey (col_id SERIAL PRIMARY KEY, col_product_id INTEGER REFERENCES tbl_product (col_id) ON DELETE CASCADE, col_name VARCHAR, col_url VARCHAR NOT NULL, col_active BOOLEAN DEFAULT FALSE, col_uuid VARCHAR(40) UNIQUE NOT NULL)" ]
},
{
......@@ -48,11 +48,6 @@
{
"version": 8,
"sql": ["ALTER TABLE tbl_survey ADD COLUMN col_uuid VARCHAR(40)"]
},
{
"version": 9,
"sql": ["ALTER TABLE tbl_aggregation ADD COLUMN col_name VARCHAR"],
"mysql": ["ALTER TABLE tbl_aggregation ADD COLUMN col_name VARCHAR(255)"]
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment