From 5a8f05e5d165b62ec8dbaa52168f13c7ae517300 Mon Sep 17 00:00:00 2001 From: Gabriel Guerra Date: Mon, 25 Mar 2024 10:17:58 -0400 Subject: [PATCH] feat(migrations): added table an initial version --- .../app/subsystems/aio/store/postgres/postgres.go | 12 ++++++++++-- internal/app/subsystems/aio/store/sqlite/sqlite.go | 8 +++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/internal/app/subsystems/aio/store/postgres/postgres.go b/internal/app/subsystems/aio/store/postgres/postgres.go index 994e2295..33b7950c 100644 --- a/internal/app/subsystems/aio/store/postgres/postgres.go +++ b/internal/app/subsystems/aio/store/postgres/postgres.go @@ -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; @@ -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 diff --git a/internal/app/subsystems/aio/store/sqlite/sqlite.go b/internal/app/subsystems/aio/store/sqlite/sqlite.go index 348547a9..bbefa993 100644 --- a/internal/app/subsystems/aio/store/sqlite/sqlite.go +++ b/internal/app/subsystems/aio/store/sqlite/sqlite.go @@ -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