rosa-build/db/migrate/20130724105821_create_platf...

30 lines
797 B
Ruby
Raw Permalink Normal View History

class CreatePlatformArchSettings < ActiveRecord::Migration
def up
create_table :platform_arch_settings do |t|
2014-01-21 04:51:49 +00:00
t.integer :platform_id, null: false
t.integer :arch_id, null: false
t.integer :time_living, null: false
t.boolean :default
t.timestamps
end
2014-01-21 04:51:49 +00:00
add_index :platform_arch_settings, [:platform_id, :arch_id], unique: true
2014-01-21 04:51:49 +00:00
arch_ids = Arch.where(name: %w(i586 x86_64)).pluck(:id)
Platform.main.each do |platform|
arch_ids.each do |arch_id|
platform.platform_arch_settings.create(
:arch_id => arch_id,
:default => true,
:time_living => PlatformArchSetting::DEFAULT_TIME_LIVING / 60
)
end
end
end
def down
2013-07-25 11:02:47 +01:00
drop_table :platform_arch_settings
end
end