OSDN Git Service

fix extend
[pettanr/pettanr.git] / db / migrate / 20130528082732_merge_color.rb
1 class MergeColor < ActiveRecord::Migration
2   def up
3     add_column :ground_colors, :code, :integer, :null => false, :default => 0
4     remove_column :ground_colors, :color_id
5     drop_table :panel_colors
6     drop_table :colors
7   end
8
9   def down
10     remove_column :ground_colors, :code
11     create_table :panel_colors do |t|
12       t.integer :panel_id, :null => false, :default => 0
13       t.integer :z, :null => false, :default => 0
14       t.integer :code, :null => false, :default => 0
15
16       t.timestamps
17     end
18     create_table :colors do |t|
19       t.string :name, :null => false, :limit => 50, :default => 'no name'
20       t.integer :code, :null => false, :default => 0
21       t.integer :t, :null => false, :default => 0
22
23       t.timestamps
24     end
25   end
26 end