diff --git a/db/migrate/20140921104907_remove_stale_memberships.rb b/db/migrate/20140921104907_remove_stale_memberships.rb new file mode 100644 index 00000000..ca55535c --- /dev/null +++ b/db/migrate/20140921104907_remove_stale_memberships.rb @@ -0,0 +1,5 @@ +class RemoveStaleMemberships < ActiveRecord::Migration + def up + Membership.where("group_id NOT IN (?)", Group.ids).delete_all + end +end diff --git a/db/schema.rb b/db/schema.rb index c8e9c41e..eb038a10 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140521142651) do +ActiveRecord::Schema.define(version: 20140921104907) do create_table "article_categories", force: true do |t| t.string "name", default: "", null: false