Skip to content

Commit

Permalink
feat(migrations): added table an initial version (#261)
Browse files Browse the repository at this point in the history
Co-authored-by: Gabriel Guerra <[email protected]>
  • Loading branch information
guergabo and Gabriel Guerra authored Mar 25, 2024
1 parent 19b8fe3 commit ea29973
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
12 changes: 10 additions & 2 deletions internal/app/subsystems/aio/store/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,14 @@ const (
time BIGINT,
attempt INTEGER,
PRIMARY KEY(id, promise_id)
);`
);
CREATE TABLE IF NOT EXISTS migrations (
id INTEGER,
PRIMARY KEY(id)
);
INSERT INTO migrations (id) VALUES (1);`

DROP_TABLE_STATEMENT = `
DROP TABLE notifications;
Expand All @@ -133,7 +140,8 @@ const (
DROP TABLE timeouts;
DROP TABLE promises;
DROP TABLE locks;
DROP TABLE tasks;`
DROP TABLE tasks;
DROP TABLE migrations;`

PROMISE_SELECT_STATEMENT = `
SELECT
Expand Down
8 changes: 7 additions & 1 deletion internal/app/subsystems/aio/store/sqlite/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ const (
time INTEGER,
attempt INTEGER,
PRIMARY KEY(id, promise_id)
);`
);
CREATE TABLE IF NOT EXISTS migrations (
id INTEGER PRIMARY KEY
);
INSERT INTO migrations (id) VALUES (1);`

PROMISE_SELECT_STATEMENT = `
SELECT
Expand Down

0 comments on commit ea29973

Please sign in to comment.