db/migrate/020_create_participation.rb in zena-0.16.9 vs db/migrate/020_create_participation.rb in zena-1.0.0.beta1
- old
+ new
@@ -7,12 +7,12 @@
t.column :contact_id, :integer
end
values = select_all("SELECT * FROM sites_users").map do |r|
"(#{['user_id','site_id','status','contact_id'].map {|k| quote(r[k])}.join(', ')})"
end
- execute "INSERT INTO participations (`user_id`,`site_id`,`status`,`contact_id`) VALUES #{values.join(', ')}" unless values == []
- Zena::Db.add_unique_key('participations', 'user_id,site_id')
+ execute "INSERT INTO participations (user_id,site_id,status,contact_id) VALUES #{values.join(', ')}" unless values == []
+ Zena::Db.add_unique_key('participations', %w{user_id site_id})
drop_table :sites_users
end
def self.down
create_table(:sites_users, :id=>false,:options => Zena::Db.table_options) do |t|
@@ -22,9 +22,9 @@
t.column :contact_id, :integer
end
values = select_all("SELECT * FROM participations").map do |r|
"(#{['user_id','site_id','status','contact_id'].map {|k| quote(r[k])}.join(', ')})"
end
- execute "INSERT INTO sites_users (`user_id`,`site_id`,`status`,`contact_id`) VALUES #{values.join(', ')}" unless values == []
+ execute "INSERT INTO sites_users (user_id,site_id,status,contact_id) VALUES #{values.join(', ')}" unless values == []
drop_table :participations
end
end