diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-14 21:38:57 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-14 21:38:57 +0400 |
commit | 13af7de9411ef20fcab00f7c5d7cdc6b90dbd4b7 (patch) | |
tree | 31876b6aa09c0c838ec3838aa0072293b3a0f0e6 /db/migrate/20140914145549_migrate_to_new_members_model.rb | |
parent | 8210d813812571b479d630ff61410347f8ebeb5b (diff) |
Fix migration and association for new members table
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'db/migrate/20140914145549_migrate_to_new_members_model.rb')
-rw-r--r-- | db/migrate/20140914145549_migrate_to_new_members_model.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/db/migrate/20140914145549_migrate_to_new_members_model.rb b/db/migrate/20140914145549_migrate_to_new_members_model.rb new file mode 100644 index 00000000000..b4f7718f26d --- /dev/null +++ b/db/migrate/20140914145549_migrate_to_new_members_model.rb @@ -0,0 +1,11 @@ +class MigrateToNewMembersModel < ActiveRecord::Migration + def up + execute "INSERT INTO members ( user_id, source_id, source_type, access_level, notification_level, type ) SELECT user_id, group_id, 'Group', group_access, notification_level, 'GroupMember' FROM users_groups" + execute "INSERT INTO members ( user_id, source_id, source_type, access_level, notification_level, type ) SELECT user_id, project_id, 'Project', project_access, notification_level, 'ProjectMember' FROM users_projects" + end + + def down + Member.delete_all + end +end + |