From 1d50d5dd226feb893532e37fa7410cb412733799 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 15 Nov 2020 16:19:55 +0100 Subject: [PATCH] Rmove unique constraint on tasks.name (closes #1001) --- changelog/60_UNRELEASED_2020-xx-xx.md | 3 +++ migrations/0118.sql | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 migrations/0118.sql diff --git a/changelog/60_UNRELEASED_2020-xx-xx.md b/changelog/60_UNRELEASED_2020-xx-xx.md index d9c13da1..823f1ce7 100644 --- a/changelog/60_UNRELEASED_2020-xx-xx.md +++ b/changelog/60_UNRELEASED_2020-xx-xx.md @@ -99,6 +99,9 @@ _- (Because the stock quantity unit is now the base for everything, it cannot be - Fixed a PHP warning when using the "Share/Integrate calendar (iCal)" button (thanks @tsia) - Fixed that "Track date only"-chores were always displayed at 12am (are now displayed as all-day events) +### Tasks improvements +- Tasks don't need to unique anymore (name field) + ### Userfield improvements/fixes - New Userfield type "File" to attach any file, will be rendered as a link to the file in tables (if enabled) (thanks @fipwmaqzufheoxq92ebc) - New Userfield type "Picture" to attach a picture, the picture will be rendered (small) in tables (if enabled) (thanks @fipwmaqzufheoxq92ebc) diff --git a/migrations/0118.sql b/migrations/0118.sql new file mode 100644 index 00000000..6ab017b9 --- /dev/null +++ b/migrations/0118.sql @@ -0,0 +1,22 @@ +PRAGMA legacy_alter_table = ON; + +ALTER TABLE tasks RENAME TO tasks_old; + +CREATE TABLE tasks ( + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, + name TEXT NOT NULL, + description TEXT, + due_date DATETIME, + done TINYINT NOT NULL DEFAULT 0 CHECK(done IN (0, 1)), + done_timestamp DATETIME, + category_id INTEGER, + assigned_to_user_id INTEGER, + row_created_timestamp DATETIME DEFAULT (datetime('now', 'localtime')) +); + +INSERT INTO tasks + (id, name, description, due_date, done, done_timestamp, category_id, assigned_to_user_id, row_created_timestamp) +SELECT id, name, description, due_date, done, done_timestamp, category_id, assigned_to_user_id, row_created_timestamp +FROM tasks_old; + +DROP TABLE tasks_old;