Skip to content

Commit 7e27172

Browse files
committed
fix(db): bring back custom migrations migrations
Ref: SRX-C0R01N
1 parent 9e9b44d commit 7e27172

5 files changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CREATE TABLE IF NOT EXISTS custom_migration_cutoff
2+
(
3+
migration_done_at TIMESTAMP NOT NULL,
4+
kuberpult_version varchar(100) PRIMARY KEY -- the version as it appears on GitHub, e.g. "1.2.3"
5+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE IF EXISTS custom_migration_cutoff;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
DO $$
2+
BEGIN
3+
IF NOT EXISTS (
4+
SELECT 1 FROM event_sourcing_light LIMIT 1
5+
) THEN
6+
INSERT INTO event_sourcing_light (eslversion, created, event_type, json)
7+
VALUES (0, now(), 'MigrationTransformer', '{"eslVersion":0,"metadata":{"authorEmail":"Migration","authorName":"Migration"}}');
8+
END IF;
9+
END
10+
$$;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
DO $$
2+
BEGIN
3+
IF NOT EXISTS (
4+
SELECT 1 FROM commit_events LIMIT 1
5+
) THEN
6+
INSERT INTO commit_events (uuid, timestamp, commitHash, eventType, json, transformereslVersion)
7+
VALUES ('00000000-0000-0000-0000-000000000000', now(), '0000000000000000000000000000000000000000', 'db-migration', '{}', 0);
8+
END IF;
9+
END
10+
$$;

docs/rollback.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ You can easily roll back to an older version of a single service
1212
![](../assets/img/rollback/releasedialog-full.png)
1313
5) Now you have 2 planned actions, that you still need to apply. ![](../assets/img/rollback/planned-actions.png)
1414

15+
# Migrations
16+
If you want to use custom migrations you can use [custom_migrations down migration](../database/migrations/postgres/1738234757185160_remove_custom_migrations.down.sql)

0 commit comments

Comments
 (0)