Database errors - schema migration

Yesterday I accidentally updated my director to master and applied the migrations. Stupid me but maybe today is your lucky day :slight_smile:

I looked into schema migrations and set up a reverse migration script to the last stable release from today master:

ALTER TABLE import_row_modifier
  DROP COLUMN filter_expression;
DELETE FROM director_schema_migration
  where schema_version = 187;

DROP INDEX uuid ON director_datafield;
ALTER TABLE director_datafield 
  DROP COLUMN uuid;
DROP INDEX uuid ON director_datalist;
ALTER TABLE director_datalist
  DROP COLUMN uuid;
DELETE FROM director_schema_migration
  where schema_version = 186;

ALTER TABLE branched_icinga_notification
  DROP COLUMN users_var;
ALTER TABLE branched_icinga_notification
  DROP COLUMN user_groups_var;
DELETE FROM director_schema_migration
  where schema_version = 184;

ALTER TABLE icinga_notification
  DROP COLUMN users_var;
ALTER TABLE icinga_notification
  DROP COLUMN user_groups_var;
DELETE FROM director_schema_migration
  where schema_version = 183;

At the end your are on schema migration 182 which is the latest stable so you can install 1.10.2

I would recommend to do it step by step, line by line, you might not need the the first block since this migration failed anyway.

THERE IS NO GUARANTEE THAT THIS WORK ON YOUR MACHINE
CHECK EACH STEP BY YOURSELF VERIFYING https://github.com/Icinga/icingaweb2-module-director/tree/master/schema/mysql-migrations 183-186
MAKE A BACKUP FIRST

and for postgres, I think you can leave out the

DROP INDEX uuid…

1 Like