From 95277c10c6c527e62871517f3e954f747af8fb97 Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Sun, 22 Nov 2015 16:26:29 +0100 Subject: [PATCH] fix migrations when upgrading from previous versions / v1.0.1 --- db/migrate/001_create_project_aliases.rb | 10 ++++++---- db/migrate/002_add_project_aliases_undeletable.rb | 4 +++- init.rb | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/db/migrate/001_create_project_aliases.rb b/db/migrate/001_create_project_aliases.rb index ff913f5..376b7c2 100644 --- a/db/migrate/001_create_project_aliases.rb +++ b/db/migrate/001_create_project_aliases.rb @@ -1,11 +1,13 @@ class CreateProjectAliases < ActiveRecord::Migration def self.up - create_table :project_aliases do |t| - t.column :project_id, :integer, :null => false - t.column :alias, :string, :null => false + unless table_exists? :project_aliases + create_table :project_aliases do |t| + t.column :project_id, :integer, :null => false + t.column :alias, :string, :null => false + end + add_index :project_aliases, [ :alias ], :unique => true, :name => :project_alias end - add_index :project_aliases, [ :alias ], :unique => true, :name => :project_alias end def self.down diff --git a/db/migrate/002_add_project_aliases_undeletable.rb b/db/migrate/002_add_project_aliases_undeletable.rb index d28ba30..1f695e1 100644 --- a/db/migrate/002_add_project_aliases_undeletable.rb +++ b/db/migrate/002_add_project_aliases_undeletable.rb @@ -1,7 +1,9 @@ class AddProjectAliasesUndeletable < ActiveRecord::Migration def self.up - add_column :project_aliases, :undeletable, :boolean, :default => false, :null => false + unless column_exists? :project_aliases, :undeletable + add_column :project_aliases, :undeletable, :boolean, :default => false, :null => false + end end def self.down diff --git a/init.rb b/init.rb index 528a936..0369d45 100644 --- a/init.rb +++ b/init.rb @@ -21,7 +21,7 @@ author 'Andriy Lesyuk & Tobias Fischer' description 'Allows adding project identifier aliases or renaming of project identifiers.' url 'https://github.com/paginagmbh/redmine_project-alias-2' - version '1.0.0' + version '1.0.1' requires_redmine :version_or_higher => '2.6' menu :admin_menu, :project_aliases,