mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-28 06:54:06 -04:00
remove invalid topic_users rows
This commit is contained in:
parent
6137bb46d3
commit
aebb15337b
1 changed files with 14 additions and 0 deletions
14
db/migrate/20160514100852_remove_invalid_topic_user.rb
Normal file
14
db/migrate/20160514100852_remove_invalid_topic_user.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
class RemoveInvalidTopicUser < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
execute <<-SQL
|
||||||
|
DELETE FROM topic_users
|
||||||
|
USING topic_users tu
|
||||||
|
LEFT JOIN users u ON u.id = tu.user_id
|
||||||
|
WHERE u.id IS NULL
|
||||||
|
AND topic_users.id = tu.id
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue