Error migrate plugin v1.5.9 #692
This commit is contained in:
parent
feec2d9f15
commit
0f6031f864
@ -19,20 +19,25 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class StatusDeleted < ActiveRecord::Migration
|
||||
|
||||
def self.cast_integer(colname)
|
||||
adapter_name = ActiveRecord::Base.connection.adapter_name.downcase
|
||||
case adapter_name
|
||||
when /postgresql/
|
||||
"integer USING CAST(#{colname} AS integer)"
|
||||
else
|
||||
'integer'
|
||||
when /postgresql/
|
||||
'INTEGER USING CASE WHEN TRUE THEN 1 ELSE 0 END'
|
||||
else
|
||||
'integer'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.up
|
||||
execute 'ALTER TABLE dmsf_folders ALTER deleted DROP DEFAULT;'
|
||||
change_column :dmsf_folders, :deleted, cast_integer(:deleted), :null => false, :default => DmsfFolder::STATUS_ACTIVE
|
||||
execute 'ALTER TABLE dmsf_files ALTER deleted DROP DEFAULT;'
|
||||
change_column :dmsf_files, :deleted, cast_integer(:deleted), :null => false, :default => DmsfFile::STATUS_ACTIVE
|
||||
execute 'ALTER TABLE dmsf_file_revisions ALTER deleted DROP DEFAULT;'
|
||||
change_column :dmsf_file_revisions, :deleted, cast_integer(:deleted), :null => false, :default => DmsfFileRevision::STATUS_ACTIVE
|
||||
execute 'ALTER TABLE dmsf_links ALTER deleted DROP DEFAULT;'
|
||||
change_column :dmsf_links, :deleted, cast_integer(:deleted), :null => false, :default => DmsfLink::STATUS_ACTIVE
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user