Use consistent name of migrations.
This commit is contained in:
parent
de0ec82d48
commit
9682fe66e4
1 changed files with 5 additions and 5 deletions
|
@ -243,7 +243,7 @@ class Package < ApplicationModel
|
||||||
location = @@root + '/db/addon/' + package.underscore
|
location = @@root + '/db/addon/' + package.underscore
|
||||||
|
|
||||||
return true if !File.exists?( location )
|
return true if !File.exists?( location )
|
||||||
migrations_done = Package::Migration.where( :name => package )
|
migrations_done = Package::Migration.where( :name => package.underscore )
|
||||||
|
|
||||||
# get existing migrations
|
# get existing migrations
|
||||||
migrations_existing = []
|
migrations_existing = []
|
||||||
|
@ -275,26 +275,26 @@ class Package < ApplicationModel
|
||||||
|
|
||||||
# down
|
# down
|
||||||
if direction == 'reverse'
|
if direction == 'reverse'
|
||||||
done = Package::Migration.where( :name => package, :version => version ).first
|
done = Package::Migration.where( :name => package.underscore, :version => version ).first
|
||||||
next if !done
|
next if !done
|
||||||
puts "NOTICE: down package migration '#{migration}'"
|
puts "NOTICE: down package migration '#{migration}'"
|
||||||
load "#{location}/#{migration}"
|
load "#{location}/#{migration}"
|
||||||
classname = name.camelcase
|
classname = name.camelcase
|
||||||
Kernel.const_get(classname).down
|
Kernel.const_get(classname).down
|
||||||
record = Package::Migration.where( :name => package, :version => version ).first
|
record = Package::Migration.where( :name => package.underscore, :version => version ).first
|
||||||
if record
|
if record
|
||||||
record.destroy
|
record.destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
# up
|
# up
|
||||||
else
|
else
|
||||||
done = Package::Migration.where( :name => package, :version => version ).first
|
done = Package::Migration.where( :name => package.underscore, :version => version ).first
|
||||||
next if done
|
next if done
|
||||||
puts "NOTICE: up package migration '#{migration}'"
|
puts "NOTICE: up package migration '#{migration}'"
|
||||||
load "#{location}/#{migration}"
|
load "#{location}/#{migration}"
|
||||||
classname = name.camelcase
|
classname = name.camelcase
|
||||||
Kernel.const_get(classname).up
|
Kernel.const_get(classname).up
|
||||||
Package::Migration.create( :name => package, :version => version )
|
Package::Migration.create( :name => package.underscore, :version => version )
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue