Class: CortexReaver::CreatedbyeditedbySchema

Inherits:
Sequel::Migration
  • Object
show all
Defined in:
lib/cortex_reaver/migrations/012_created_by_edited_by.rb

Instance Method Summary collapse

Instance Method Details

#downObject



3
4
5
6
7
8
9
10
11
# File 'lib/cortex_reaver/migrations/012_created_by_edited_by.rb', line 3

def down
  [:journals, :comments, :pages, :photographs, :projects].each do |table|
    alter_table table do
      rename_column :created_by, :user_id, :type => :integer
      # Can't do this yet.
#          drop_column :updated_by
    end
  end
end

#upObject



13
14
15
16
17
18
19
20
21
# File 'lib/cortex_reaver/migrations/012_created_by_edited_by.rb', line 13

def up
  [:journals, :comments, :pages, :photographs, :projects].each do |table|
    alter_table table do
      rename_column :user_id, :created_by, :type => :integer
      add_foreign_key :updated_by, :users, :key => :id
      add_index :updated_by
    end
  end
end