Browse files

ChangeMigrationAsExercice

  • Loading branch information...
1 parent ca5b75a commit 9ae3b7c956da6f708fa2fde90c5d42f25448b6a4 @first-developer committed May 20, 2011
View
2 db/migrate/20110520075738_create_sections.rb
@@ -4,11 +4,13 @@ def self.up
t.string :name
t.integer :position
t.boolean :visible
+ t.references :page
t.string :content_type
t.text :content
t.timestamps
end
+ add_index("sections","page_id")
end
def self.down
View
2 db/migrate/20110520114216_create_subjects.rb
@@ -3,7 +3,7 @@ def self.up
create_table :subjects do |t|
t.string :name
t.integer :position
- t.boolean :visible
+ t.boolean :visible , :default => false
t.timestamps
end
View
5 db/migrate/20110520143943_create_pages.rb
@@ -4,11 +4,14 @@ def self.up
t.string :name
t.string :permalink
t.integer :position
- t.boolean :visible
+ t.boolean :visible, :default => false
t.references :subject
t.timestamps
end
+ add_index("pages","subject_id")
+ add_index("pages","permalink")
+
end
def self.down
View
10 db/migrate/20110520234715_update_column_from_exercise.rb
@@ -0,0 +1,10 @@
+class UpdateColumnFromExercise < ActiveRecord::Migration
+ def self.up
+ change_column("pages","visible",:string,:default => false)
+ change_column("subjects","visible",:string,:default => false)
+ change_column("sections","visible",:string,:default => false)
+ end
+
+ def self.down
+ end
+end
View
11 db/schema.rb
@@ -10,22 +10,25 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110520143943) do
+ActiveRecord::Schema.define(:version => 20110520234715) do
create_table "pages", :force => true do |t|
t.string "name"
t.string "permalink"
t.integer "position"
- t.boolean "visible"
+ t.string "visible", :default => "f"
t.integer "subject_id"
t.datetime "created_at"
t.datetime "updated_at"
end
+ add_index "pages", ["permalink"], :name => "index_pages_on_permalink"
+ add_index "pages", ["subject_id"], :name => "index_pages_on_subject_id"
+
create_table "sections", :force => true do |t|
t.string "name"
t.integer "position"
- t.boolean "visible"
+ t.string "visible", :default => "f"
t.string "content_type"
t.text "content"
t.datetime "created_at"
@@ -35,7 +38,7 @@
create_table "subjects", :force => true do |t|
t.string "name"
t.integer "position"
- t.boolean "visible"
+ t.string "visible", :default => "f"
t.datetime "created_at"
t.datetime "updated_at"
end

0 comments on commit 9ae3b7c

Please sign in to comment.