From 29da6be0f461107010336c16429a84a73a3a865a Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Fri, 23 Dec 2016 10:35:02 +0100 Subject: [PATCH] Added doc to fix migrations table --- docs/migration-guide.md | 15 +++++++++++++++ scripts/fix-migrations-version-1.sql | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 docs/migration-guide.md create mode 100644 scripts/fix-migrations-version-1.sql diff --git a/docs/migration-guide.md b/docs/migration-guide.md new file mode 100644 index 0000000000..9135a919dc --- /dev/null +++ b/docs/migration-guide.md @@ -0,0 +1,15 @@ +# Migrations guide + +## Upgrading from v1.0 to 2.0 + +### Cavat 1: Not used db-migrate to migrate the unleash database +In FINN we used, for internal reasons, liquebase to migrate our database. +Because unleash from version 2.0 migrates the datbase internally, with db-migrate, +you need to make sure that all previous migrations for version 1 exists, so unleash +does not try to create tables that already exists. + +#### How to check? +If you don't a "migrations" table with _7 unique migrations_ you are affected by this cavat. + +#### How to fix? +Before starting unleash version 2 you have to run the SQL located under `scripts/fix-migrations-version-1.sql` diff --git a/scripts/fix-migrations-version-1.sql b/scripts/fix-migrations-version-1.sql new file mode 100644 index 0000000000..e0a26b7a6e --- /dev/null +++ b/scripts/fix-migrations-version-1.sql @@ -0,0 +1,9 @@ +CREATE TABLE migrations ( id SERIAL NOT NULL, name CHARACTER VARYING(255) NOT NULL, run_on TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY (id) ); +insert into migrations (id, name, run_on) values (1, '/20141020151056-initial-schema', '2016-12-23 10:08:28'); +insert into migrations (id, name, run_on) values (2, '/20141110144153-add-description-to-features', '2016-12-23 10:08:31'); +insert into migrations (id, name, run_on) values (3, '/20141117200435-add-parameters-template-to-strategies', '2016-12-23 10:08:32'); +insert into migrations (id, name, run_on) values (4, '/20141117202209-insert-default-strategy', '2016-12-23 10:08:36'); +insert into migrations (id, name, run_on) values (5, '/20141118071458-default-strategy-event', '2016-12-23 10:10:35'); +insert into migrations (id, name, run_on) values (6, '/20141215210141-005-archived-flag-to-features', '2016-12-23 10:10:39'); +insert into migrations (id, name, run_on) values (7, '/20150210152531-006-rename-eventtype', '2016-12-23 10:10:48'); +ALTER SEQUENCE migrations_id_seq restart 8 \ No newline at end of file