Switch from schema.rb to migrations

This commit is contained in:
Alexey Verkhovsky 2005-12-30 07:24:51 +00:00
parent 7de64bdecf
commit 9cf5315d8b
3 changed files with 92 additions and 78 deletions

View file

@ -0,0 +1,56 @@
class Beta1Schema < ActiveRecord::Migration
def self.up
create_table "pages", :force => true do |t|
t.column "created_at", :datetime, :null => false
t.column "updated_at", :datetime, :null => false
t.column "web_id", :integer, :default => 0, :null => false
t.column "locked_by", :string, :limit => 60
t.column "name", :string, :limit => 60
t.column "locked_at", :datetime
end
create_table "revisions", :force => true do |t|
t.column "created_at", :datetime, :null => false
t.column "updated_at", :datetime, :null => false
t.column "revised_at", :datetime, :null => false
t.column "page_id", :integer, :default => 0, :null => false
t.column "content", :text, :default => "", :null => false
t.column "author", :string, :limit => 60
t.column "ip", :string, :limit => 60
end
create_table "system", :force => true do |t|
t.column "password", :string, :limit => 60
end
create_table "webs", :force => true do |t|
t.column "created_at", :datetime, :null => false
t.column "updated_at", :datetime, :null => false
t.column "name", :string, :limit => 60, :default => "", :null => false
t.column "address", :string, :limit => 60, :default => "", :null => false
t.column "password", :string, :limit => 60
t.column "additional_style", :string
t.column "allow_uploads", :integer, :limit => 4, :default => 1
t.column "published", :integer, :limit => 4, :default => 0
t.column "count_pages", :integer, :limit => 4, :default => 0
t.column "markup", :string, :limit => 50, :default => "textile"
t.column "color", :string, :limit => 6, :default => "008B26"
t.column "max_upload_size", :integer, :default => 100
t.column "safe_mode", :integer, :limit => 4, :default => 0
t.column "brackets_only", :integer, :limit => 4, :default => 0
end
create_table "wiki_references", :force => true do |t|
t.column "created_at", :datetime, :null => false
t.column "updated_at", :datetime, :null => false
t.column "page_id", :integer, :default => 0, :null => false
t.column "referenced_name", :string, :limit => 60, :default => "", :null => false
t.column "link_type", :string, :limit => 1, :default => "", :null => false
end
end
def self.down
raise 'Initial schema - cannot be further reverted'
end
end

View file

@ -0,0 +1,36 @@
class Beta2ChangesBulk < ActiveRecord::Migration
def self.up
add_index "revisions", "page_id"
add_index "revisions", "created_at"
add_index "revisions", "author"
create_table "sessions", :force => true do |t|
t.column "session_id", :string
t.column "data", :text
t.column "updated_at", :datetime
end
add_index "sessions", "session_id"
create_table "wiki_files", :force => true do |t|
t.column "created_at", :datetime, :null => false
t.column "updated_at", :datetime, :null => false
t.column "web_id", :integer, :null => false
t.column "file_name", :string, :null => false
t.column "description", :string, :null => false
end
add_index "wiki_references", "page_id"
add_index "wiki_references", "referenced_name"
end
def self.down
remove_index "wiki_references", "referenced_name"
remove_index "wiki_references", "page_id"
drop_table "wiki_files"
remove_index "sessions", "session_id"
drop_table "sessions"
remove_index "revisions", "author"
remove_index "revisions", "created_at"
remove_index "revisions", "page_id"
end
end

View file

@ -1,78 +0,0 @@
# This file is autogenerated. Instead of editing this file, please use the
# migrations feature of ActiveRecord to incrementally modify your database, and
# then regenerate this schema definition.
ActiveRecord::Schema.define() do
create_table "pages", :force => true do |t|
t.column "created_at", :datetime, :null => false
t.column "updated_at", :datetime, :null => false
t.column "web_id", :integer, :null => false
t.column "locked_by", :string, :limit => 60
t.column "name", :string, :limit => 60
t.column "locked_at", :datetime
end
create_table "revisions", :force => true do |t|
t.column "created_at", :datetime, :null => false
t.column "updated_at", :datetime, :null => false
t.column "revised_at", :datetime, :null => false
t.column "page_id", :integer, :null => false
t.column "content", :text, :null => false
t.column "author", :string, :limit => 60
t.column "ip", :string, :limit => 60
end
add_index "revisions", ["page_id"], :name => "revisions_page_id_index"
add_index "revisions", ["created_at"], :name => "revisions_created_at_index"
add_index "revisions", ["author"], :name => "revisions_author_index"
create_table "sessions", :force => true do |t|
t.column "session_id", :string
t.column "data", :text
t.column "updated_at", :datetime
end
add_index "sessions", ["session_id"], :name => "sessions_session_id_index"
create_table "system", :force => true do |t|
t.column "password", :string, :limit => 60
end
create_table "webs", :force => true do |t|
t.column "created_at", :datetime, :null => false
t.column "updated_at", :datetime, :null => false
t.column "name", :string, :limit => 60, :null => false
t.column "address", :string, :limit => 60, :null => false
t.column "password", :string, :limit => 60
t.column "additional_style", :string
t.column "allow_uploads", :integer, :default => 1
t.column "published", :integer, :default => 0
t.column "count_pages", :integer, :default => 0
t.column "markup", :string, :limit => 50, :default => "textile"
t.column "color", :string, :limit => 6, :default => "008B26"
t.column "max_upload_size", :integer, :default => 100
t.column "safe_mode", :integer, :default => 0
t.column "brackets_only", :integer, :default => 0
end
create_table "wiki_files", :force => true do |t|
t.column "created_at", :datetime, :null => false
t.column "updated_at", :datetime, :null => false
t.column "web_id", :integer, :null => false
t.column "file_name", :string, :null => false
t.column "description", :string, :null => false
end
create_table "wiki_references", :force => true do |t|
t.column "created_at", :datetime, :null => false
t.column "updated_at", :datetime, :null => false
t.column "page_id", :integer, :null => false
t.column "referenced_name", :string, :limit => 60, :null => false
t.column "link_type", :string, :limit => 1, :null => false
end
add_index "wiki_references", ["page_id"], :name => "wiki_references_page_id_index"
add_index "wiki_references", ["referenced_name"], :name => "wiki_references_referenced_name_index"
end