-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db765c2
commit 6459a31
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class SeedSiteAnnouncementViews < ActiveRecord::Migration[5.2] | ||
def up | ||
execute 'SET statement_timeout TO DEFAULT' | ||
execute <<-SQL | ||
INSERT INTO site_announcement_views (user_id, announcement_id) | ||
SELECT | ||
users.id AS user_id, | ||
site_announcements.id AS announcement_id | ||
FROM users | ||
CROSS JOIN site_announcements | ||
ON CONFLICT DO NOTHING; | ||
SQL | ||
end | ||
|
||
def down | ||
execute 'TRUNCATE site_announcement_views' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters