ref: master
db/migrate/20150921140802_create_custom_fields.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
class CreateCustomFields < ActiveRecord::Migration def change create_table :custom_fields do |t| t.string :name t.string :format, :default => "" t.text :default_value, :default => "" t.string :customized_type t.text :extras, :default => "" t.boolean :active, :default => false t.boolean :required, :default => false t.boolean :signup, :default => false t.integer :environment_id t.timestamps end create_table :custom_field_values do |t| t.column "customized_type", :string, :default => "", :null => false t.column "customized_id", :integer, :default => 0, :null => false t.column "public", :boolean, :default => false, :null => false t.column "custom_field_id", :integer, :default => 0, :null => false t.column "value", :text, :default => "" t.timestamps end add_index :custom_field_values, ["customized_type", "customized_id","custom_field_id"], :unique => true, :name => 'index_custom_field_values' add_index :custom_fields, ["customized_type","name","environment_id"], :unique => true, :name => 'index_custom_field' end end |