Merge branch 'master' into 2272-setup-user-in-workbench
[arvados.git] / services / api / db / migrate / 20130125220425_rename_created_by_to_owner.rb
1 class RenameCreatedByToOwner < ActiveRecord::Migration
2   def tables
3     %w{api_clients collections logs metadata nodes pipelines pipeline_invocations projects specimens users}
4   end
5
6   def up
7     tables.each do |t|
8       remove_column t.to_sym, :created_by_client
9       rename_column t.to_sym, :created_by_user, :owner
10     end
11   end
12
13   def down
14     tables.reverse.each do |t|
15       rename_column t.to_sym, :owner, :created_by_user
16       add_column t.to_sym, :created_by_client, :string
17     end
18   end
19 end