Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(be): clear migrations #2504

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions db/sql/migrations/v0.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
);

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,
Expand Down Expand Up @@ -101,12 +102,13 @@
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,

Check failure on line 107 in db/sql/migrations/v0.0.0.sql

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

db/sql/migrations/v0.0.0.sql#L107

syntax error at or near "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
);
17 changes: 11 additions & 6 deletions db/sql/migrations/v1.4.0.sql
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
16 changes: 0 additions & 16 deletions db/sql/migrations/v2.2.1.sql
Original file line number Diff line number Diff line change
@@ -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;
1 change: 0 additions & 1 deletion db/sql/migrations/v2.7.4.sql
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
alter table `event` add `user_id` int null references `user`(`id`);
14 changes: 0 additions & 14 deletions db/sql/migrations/v2.8.20.sql
Original file line number Diff line number Diff line change
@@ -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
);
Loading