Commit d5148ade by Rocky Duan

don't need migrations

parent 890c5c0c
# Taken and modified from gem 'acts_as_commentable_with_threading':
# https://github.com/elight/acts_as_commentable_with_threading/blob/master/lib/generators/acts_as_commentable_with_threading_migration/templates/migration.rb
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.text :body
t.text :title, :default => ""
t.string :ancestry
t.integer :user_id
t.integer :course_id
t.integer :comment_thread_id
t.timestamps
end
add_index :comments, :user_id
add_index :comments, :course_id
add_index :comments, :ancestry
end
def self.down
drop_table :comments
end
end
class CreateCommentThreads < ActiveRecord::Migration
def self.up
create_table :comment_threads do |t|
t.string :commentable_type
t.string :commentable_id
t.timestamps
end
end
def self.down
drop_table :comment_threads
end
end
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
end
end
def self.down
drop_table :users
end
end
class CreateVotes < ActiveRecord::Migration
def self.up
create_table :votes, :force => true do |t|
t.boolean :vote, :default => false
t.references :voteable, :polymorphic => true, :null => false
t.references :voter, :polymorphic => true
t.timestamps
end
add_index :votes, [:voter_id, :voter_type]
add_index :votes, [:voteable_id, :voteable_type]
add_index :votes, [:voter_id, :voter_type, :voteable_id, :voteable_type], :unique => true, :name => 'fk_one_vote_per_user_per_entity'
end
def self.down
drop_table :votes
end
end
class AddAncestryDepthToComments < ActiveRecord::Migration
def self.up
add_column :comments, :ancestry_depth, :integer, :default => 0
end
def self.down
remove_column :comments, :ancestry_depth
end
end
class AddEndorsedToComments < ActiveRecord::Migration
def self.up
add_column :comments, :endorsed, :boolean, :default => false
end
def self.down
remove_column :comments, :endorsed
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment