diff options
author | 2010-12-11 15:26:49 +0100 | |
---|---|---|
committer | 2010-12-15 18:14:10 +0100 | |
commit | 40abc60951ef779ee02ee4f21018a85168d1ae67 (patch) | |
tree | 73b42d94c320c3bf55c2ce35f69704bb07b58979 | |
parent | Load Mail::Message customization automatically (diff) | |
download | recruiting-webapp-40abc60951ef779ee02ee4f21018a85168d1ae67.tar.gz recruiting-webapp-40abc60951ef779ee02ee4f21018a85168d1ae67.tar.bz2 recruiting-webapp-40abc60951ef779ee02ee4f21018a85168d1ae67.zip |
Start tracking migrations
Migrations are useful for applications that are working, so
we shall track them. Includes initial migrations.
Removes app/models/job.rb because it caused problems for hobo_migration
generator.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | app/models/job.rb | 18 | ||||
-rw-r--r-- | db/migrate/20101211142151_hobo_migration_1.rb | 156 | ||||
-rw-r--r-- | db/migrate/20101211142354_create_delayed_jobs.rb | 20 | ||||
-rw-r--r-- | db/schema.rb | 12 |
5 files changed, 182 insertions, 25 deletions
@@ -1,5 +1,4 @@ db/*.sqlite3 -db/migrate db/seeds.rb log test diff --git a/app/models/job.rb b/app/models/job.rb deleted file mode 100644 index 7afa6f7..0000000 --- a/app/models/job.rb +++ /dev/null @@ -1,18 +0,0 @@ -# Don't use this class. -# -# Only purpose of this class is to let hobo_migration generator know that it -# should create delayed_jobs table. -class Job < ActiveRecord::Base - set_table_name "delayed_jobs" - fields do - priority :integer, :default => 0 - attempts :integer, :default => 0 - handler :text - last_error :string - run_at :datetime - locked_at :datetime - failed_at :datetime - locked_by :string - timestamps - end -end diff --git a/db/migrate/20101211142151_hobo_migration_1.rb b/db/migrate/20101211142151_hobo_migration_1.rb new file mode 100644 index 0000000..8b5b8ec --- /dev/null +++ b/db/migrate/20101211142151_hobo_migration_1.rb @@ -0,0 +1,156 @@ +class HoboMigration1 < ActiveRecord::Migration + def self.up + create_table :project_acceptances do |t| + t.string :accepting_nick, :null => false + t.boolean :accepted, :default => false + t.datetime :created_at + t.datetime :updated_at + t.integer :user_id, :null => false + end + add_index :project_acceptances, [:user_id] + + create_table :question_categories do |t| + t.string :name, :null => false + t.datetime :created_at + t.datetime :updated_at + end + + create_table :comments do |t| + t.text :content, :null => false + t.datetime :created_at + t.datetime :updated_at + t.integer :answer_id, :null => false + t.integer :owner_id + end + add_index :comments, [:answer_id] + add_index :comments, [:owner_id] + + create_table :questions do |t| + t.string :title, :null => false + t.string :documentation + t.boolean :approved, :default => false + t.datetime :created_at + t.datetime :updated_at + t.integer :user_id + t.integer :question_category_id + t.integer :question_group_id + end + add_index :questions, [:user_id] + add_index :questions, [:question_category_id] + add_index :questions, [:question_group_id] + + create_table :question_content_multiple_choices do |t| + t.text :content, :null => false + t.datetime :created_at + t.datetime :updated_at + t.integer :question_id, :null => false + end + add_index :question_content_multiple_choices, [:question_id] + + create_table :question_groups do |t| + t.string :name, :null => false + t.text :description, :null => false + t.datetime :created_at + t.datetime :updated_at + end + + create_table :question_content_emails do |t| + t.text :requirements, :null => false, :default => "" + t.text :description + t.datetime :created_at + t.datetime :updated_at + t.integer :question_id, :null => false + end + add_index :question_content_emails, [:question_id] + + create_table :user_categories do |t| + t.datetime :created_at + t.datetime :updated_at + t.integer :user_id, :null => false + t.integer :question_category_id, :null => false + end + add_index :user_categories, [:user_id] + add_index :user_categories, [:question_category_id] + + create_table :user_question_groups do |t| + t.datetime :created_at + t.datetime :updated_at + t.integer :user_id, :null => false + t.integer :question_id, :null => false + end + add_index :user_question_groups, [:user_id] + add_index :user_question_groups, [:question_id] + + create_table :question_content_texts do |t| + t.text :content, :null => false + t.datetime :created_at + t.datetime :updated_at + t.integer :question_id, :null => false + end + add_index :question_content_texts, [:question_id] + + create_table :users do |t| + t.string :crypted_password, :limit => 40 + t.string :salt, :limit => 40 + t.string :remember_token + t.datetime :remember_token_expires_at + t.string :name + t.string :email_address + t.boolean :administrator, :default => false + t.string :role, :default => "recruit" + t.string :nick + t.string :openid + t.text :contributions + t.boolean :project_lead, :default => false + t.string :token + t.datetime :created_at + t.datetime :updated_at + t.integer :mentor_id + t.string :state, :default => "active" + t.datetime :key_timestamp + end + add_index :users, [:mentor_id] + add_index :users, [:state] + + create_table :options do |t| + t.string :content, :null => false + t.datetime :created_at + t.datetime :updated_at + t.integer :option_owner_id, :null => false + t.string :option_owner_type, :null => false + end + add_index :options, [:option_owner_type, :option_owner_id] + + create_table :answers do |t| + t.text :content, :null => false, :default => "" + t.boolean :approved, :default => false + t.boolean :reference, :default => false + t.string :feedback, :default => "" + t.datetime :created_at + t.datetime :updated_at + t.integer :question_id, :null => false + t.integer :owner_id + t.boolean :correct + t.string :type + end + add_index :answers, [:question_id] + add_index :answers, [:owner_id] + add_index :answers, [:type] + end + + def self.down + drop_table :project_acceptances + drop_table :question_categories + drop_table :comments + drop_table :questions + drop_table :question_content_multiple_choices + drop_table :question_groups + drop_table :question_content_emails + drop_table :user_categories + drop_table :user_question_groups + drop_table :question_content_texts + drop_table :users + drop_table :options + drop_table :answers + end +end diff --git a/db/migrate/20101211142354_create_delayed_jobs.rb b/db/migrate/20101211142354_create_delayed_jobs.rb new file mode 100644 index 0000000..c845e9c --- /dev/null +++ b/db/migrate/20101211142354_create_delayed_jobs.rb @@ -0,0 +1,20 @@ +class CreateDelayedJobs < ActiveRecord::Migration + def self.up + create_table :delayed_jobs do |t| + t.integer :priority, :default => 0 + t.integer :attempts, :default => 0 + t.text :handler + t.string :last_error + t.datetime :run_at + t.datetime :locked_at + t.datetime :failed_at + t.string :locked_by + t.datetime :created_at + t.datetime :updated_at + end + end + + def self.down + drop_table :delayed_jobs + end +end diff --git a/db/schema.rb b/db/schema.rb index 9fcf580..49089a1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,19 +9,19 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20101005121508) do +ActiveRecord::Schema.define(:version => 20101211142354) do create_table "answers", :force => true do |t| t.text "content", :default => "", :null => false t.boolean "approved", :default => false t.boolean "reference", :default => false + t.string "feedback", :default => "" t.datetime "created_at" t.datetime "updated_at" t.integer "question_id", :null => false t.integer "owner_id" - t.string "type" - t.string "feedback", :default => "" t.boolean "correct" + t.string "type" end add_index "answers", ["owner_id"], :name => "index_answers_on_owner_id" @@ -158,15 +158,15 @@ ActiveRecord::Schema.define(:version => 20101005121508) do t.boolean "administrator", :default => false t.string "role", :default => "recruit" t.string "nick" + t.string "openid" t.text "contributions" + t.boolean "project_lead", :default => false + t.string "token" t.datetime "created_at" t.datetime "updated_at" t.integer "mentor_id" t.string "state", :default => "active" t.datetime "key_timestamp" - t.boolean "project_lead", :default => false - t.string "token" - t.string "openid" end add_index "users", ["mentor_id"], :name => "index_users_on_mentor_id" |