MSP-4182 Add autoincrement to isp_config_service__event id field

This commit is contained in:
Синельник Тимур Романович committed 2024-10-02 10:02:25 +03:00
1 parent 38c4295d0b
commit e1547dbb94
1 file changed
+31
@@ -0,0 +1,31 @@
-- +goose Up
-- +goose NO TRANSACTION
CREATE TABLE isp_config_service__event_autoincrement (
id integer primary key autoincrement,
payload blob not null,
created_at integer not null default (unixepoch())
);
INSERT INTO
isp_config_service__event_autoincrement (id, payload, created_at)
SELECT id, payload, created_at
FROM isp_config_service__event;
DROP TABLE isp_config_service__event;
ALTER TABLE isp_config_service__event_autoincrement RENAME TO isp_config_service__event;
-- +goose Down
CREATE TABLE isp_config_service__event_without_autoincrement (
id integer primary key,
payload blob not null,
created_at integer not null default (unixepoch())
);
INSERT INTO
isp_config_service__event_without_autoincrement (id, payload, created_at)
SELECT id, payload, created_at
FROM isp_config_service__event;
DROP TABLE isp_config_service__event;
ALTER TABLE isp_config_service__event_without_autoincrement
RENAME TO isp_config_service__event;