Skip to content

Commit 18d98b2

Browse files
committed
feat(db): add migrations
1 parent 6e8979e commit 18d98b2

File tree

7 files changed

+36
-29
lines changed

7 files changed

+36
-29
lines changed

db/Migration.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ func GetMigrations(dialect string) []Migration {
2626
if dialect == util.DbDriverSQLite {
2727
return []Migration{
2828
{Version: "2.15.1.sqlite"},
29-
{Version: "2.16.0.sqlite"},
29+
{Version: "2.15.1"},
30+
{Version: "2.15.2"},
31+
{Version: "2.15.3"},
32+
{Version: "2.15.4"},
33+
{Version: "2.16.0"},
3034
}
3135
}
3236

@@ -102,6 +106,9 @@ func GetMigrations(dialect string) []Migration {
102106
{Version: "2.14.12"},
103107
{Version: "2.15.0"},
104108
{Version: "2.15.1"},
109+
{Version: "2.15.2"},
110+
{Version: "2.15.3"},
111+
{Version: "2.15.4"},
105112
{Version: "2.16.0"},
106113
}
107114
}

db/sql/migrations/v2.15.3.err.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
drop table task__ansible_error;
2+
drop table task__ansible_host;

db/sql/migrations/v2.15.3.sql

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
create table task__ansible_error(
2+
`id` integer primary key autoincrement,
3+
`task_id` int NOT NULL,
4+
`project_id` int NOT NULL,
5+
`task` varchar(250) NOT NULL,
6+
`error` varchar(1000) NOT NULL,
7+
foreign key (`project_id`) references `project`(`id`) on delete cascade,
8+
foreign key (`task_id`) references `task`(`id`) on delete cascade
9+
);
10+
create table task__ansible_host(
11+
`id` integer primary key autoincrement,
12+
`task_id` int NOT NULL,
13+
`project_id` int NOT NULL,
14+
`host` varchar(250) NOT NULL,
15+
`failed` int NOT NULL,
16+
`ignored` int NOT NULL,
17+
`changed` int NOT NULL,
18+
`ok` int NOT NULL,
19+
`rescued` int NOT NULL,
20+
`skipped` int NOT NULL,
21+
`unreachable` int NOT NULL,
22+
foreign key (`project_id`) references `project`(`id`) on delete cascade,
23+
foreign key (`task_id`) references `task`(`id`) on delete cascade
24+
);

db/sql/migrations/v2.15.4.err.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alter table `task__ansible_error` drop `host`;

db/sql/migrations/v2.15.4.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alter table `task__ansible_error` add `host` varchar(250);

db/sql/migrations/v2.16.0.sqlite.err.sql

Lines changed: 0 additions & 8 deletions
This file was deleted.

db/sql/migrations/v2.16.0.sqlite.sql

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)