Skip to content

Commit

Permalink
fix migrations when upgrading from previous versions / v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Fischer committed Nov 22, 2015
1 parent bb7f2b0 commit 95277c1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions db/migrate/001_create_project_aliases.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion db/migrate/002_add_project_aliases_undeletable.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 95277c1

Please sign in to comment.