Commit 540b22360ce313818c26776ed08830ac38cc176f

Authored by Braulio Bhavamitra
Committed by Rafael Martins
1 parent 04d456df

Fix migration and add migrations to schema

db/migrate/20110729130913_add_region_type_id_to_national_regions.rb
1 class AddRegionTypeIdToNationalRegions < ActiveRecord::Migration 1 class AddRegionTypeIdToNationalRegions < ActiveRecord::Migration
2 def self.up 2 def self.up
3 - add_column :national_regions, :national_region_type_id, :integer, :null => false 3 + add_column :national_regions, :national_region_type_id, :integer
4 end 4 end
5 5
6 def self.down 6 def self.down
@@ -325,6 +325,22 @@ ActiveRecord::Schema.define(:version =&gt; 20111004184104) do @@ -325,6 +325,22 @@ ActiveRecord::Schema.define(:version =&gt; 20111004184104) do
325 t.datetime "updated_at" 325 t.datetime "updated_at"
326 end 326 end
327 327
  328 + create_table "national_region_types", :force => true do |t|
  329 + t.string "name"
  330 + end
  331 +
  332 + create_table "national_regions", :force => true do |t|
  333 + t.string "name"
  334 + t.string "national_region_code"
  335 + t.string "parent_national_region_code"
  336 + t.datetime "created_at"
  337 + t.datetime "updated_at"
  338 + t.integer "national_region_type_id"
  339 + end
  340 +
  341 + add_index "national_regions", ["name"], :name => "name_index"
  342 + add_index "national_regions", ["national_region_code"], :name => "code_index"
  343 +
328 create_table "price_details", :force => true do |t| 344 create_table "price_details", :force => true do |t|
329 t.decimal "price", :default => 0.0 345 t.decimal "price", :default => 0.0
330 t.integer "product_id" 346 t.integer "product_id"
@@ -384,7 +400,7 @@ ActiveRecord::Schema.define(:version =&gt; 20111004184104) do @@ -384,7 +400,7 @@ ActiveRecord::Schema.define(:version =&gt; 20111004184104) do
384 t.string "type" 400 t.string "type"
385 t.string "identifier" 401 t.string "identifier"
386 t.integer "environment_id" 402 t.integer "environment_id"
387 - t.boolean "active", :default => true 403 + t.boolean "active", :default => true
388 t.string "address" 404 t.string "address"
389 t.string "contact_phone" 405 t.string "contact_phone"
390 t.integer "home_page_id" 406 t.integer "home_page_id"
@@ -395,19 +411,20 @@ ActiveRecord::Schema.define(:version =&gt; 20111004184104) do @@ -395,19 +411,20 @@ ActiveRecord::Schema.define(:version =&gt; 20111004184104) do
395 t.float "lat" 411 t.float "lat"
396 t.float "lng" 412 t.float "lng"
397 t.integer "geocode_precision" 413 t.integer "geocode_precision"
398 - t.boolean "enabled", :default => true  
399 - t.string "nickname", :limit => 16 414 + t.boolean "enabled", :default => true
  415 + t.string "nickname", :limit => 16
400 t.text "custom_header" 416 t.text "custom_header"
401 t.text "custom_footer" 417 t.text "custom_footer"
402 t.string "theme" 418 t.string "theme"
403 - t.boolean "public_profile", :default => true 419 + t.boolean "public_profile", :default => true
404 t.date "birth_date" 420 t.date "birth_date"
405 t.integer "preferred_domain_id" 421 t.integer "preferred_domain_id"
406 t.datetime "updated_at" 422 t.datetime "updated_at"
407 - t.boolean "visible", :default => true 423 + t.boolean "visible", :default => true
408 t.integer "image_id" 424 t.integer "image_id"
409 - t.boolean "validated", :default => true 425 + t.boolean "validated", :default => true
410 t.string "cnpj" 426 t.string "cnpj"
  427 + t.string "national_region_code"
411 end 428 end
412 429
413 add_index "profiles", ["environment_id"], :name => "index_profiles_on_environment_id" 430 add_index "profiles", ["environment_id"], :name => "index_profiles_on_environment_id"