diff --git a/db/sql/migrations/v0.0.0.sql b/db/sql/migrations/v0.0.0.sql index ed69212bf..01bb82f5d 100644 --- a/db/sql/migrations/v0.0.0.sql +++ b/db/sql/migrations/v0.0.0.sql @@ -17,6 +17,7 @@ create table `project` ( ); create table `project__user` ( + `id` integer primary key autoincrement, `project_id` int not null, `user_id` int not null, `admin` boolean not null default false, @@ -101,12 +102,13 @@ create table `task` ( foreign key (`template_id`) references project__template(`id`) on delete cascade ); -create table `task__output` ( - `task_id` int not null, - `task` varchar(255) not null, - `time` datetime not null, - `output` longtext not null, +create table task__output +( + id integer primary key autoincrement, + task_id int not null, + task varchar(255) not null, + time datetime not null, + output longtext not null, - unique (`task_id`, `time`), - foreign key (`task_id`) references task(`id`) on delete cascade -); + foreign key (`task_id`) references task(`id`) on delete cascade +); \ No newline at end of file diff --git a/db/sql/migrations/v1.4.0.sql b/db/sql/migrations/v1.4.0.sql index 635532ead..690e6f3df 100644 --- a/db/sql/migrations/v1.4.0.sql +++ b/db/sql/migrations/v1.4.0.sql @@ -1,9 +1,14 @@ -CREATE TABLE `event` ( - `project_id` int DEFAULT NULL, - `object_id` int DEFAULT NULL, - `object_type` varchar(20) DEFAULT '', - `description` text, - `created` datetime NOT NULL +create table `event` +( + `id` integer primary key autoincrement, + `project_id` int, + `object_id` int, + `object_type` varchar(20) DEFAULT '', + `description` text, + `created` datetime NOT NULL, + `user_id` int, + foreign key (`project_id`) references `project` (`id`) on delete cascade, + foreign key (`user_id`) references `user` (`id`) on delete set null ); alter table `task` add `created` datetime null; diff --git a/db/sql/migrations/v2.2.1.sql b/db/sql/migrations/v2.2.1.sql index 2cf48247d..e69de29bb 100644 --- a/db/sql/migrations/v2.2.1.sql +++ b/db/sql/migrations/v2.2.1.sql @@ -1,16 +0,0 @@ -alter table task__output rename to task__output_backup; - -create table task__output -( - id integer primary key autoincrement, - task_id int not null, - task varchar(255) not null, - time datetime not null, - output longtext not null, - - foreign key (`task_id`) references task(`id`) on delete cascade -); - -insert into task__output(task_id, task, time, output) select * from task__output_backup; - -drop table task__output_backup; diff --git a/db/sql/migrations/v2.7.4.sql b/db/sql/migrations/v2.7.4.sql index 647b07c90..e69de29bb 100644 --- a/db/sql/migrations/v2.7.4.sql +++ b/db/sql/migrations/v2.7.4.sql @@ -1 +0,0 @@ -alter table `event` add `user_id` int null references `user`(`id`); diff --git a/db/sql/migrations/v2.8.20.sql b/db/sql/migrations/v2.8.20.sql index 3cd5d28b6..e69de29bb 100644 --- a/db/sql/migrations/v2.8.20.sql +++ b/db/sql/migrations/v2.8.20.sql @@ -1,14 +0,0 @@ -alter table `event` rename to `event_backup_5784568`; - -create table `event` -( - `id` integer primary key autoincrement, - `project_id` int, - `object_id` int, - `object_type` varchar(20) DEFAULT '', - `description` text, - `created` datetime NOT NULL, - `user_id` int, - foreign key (`project_id`) references `project` (`id`) on delete cascade, - foreign key (`user_id`) references `user` (`id`) on delete set null -);