Last active
December 23, 2015 08:49
-
-
Save nicolasiensen/6610444 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class CreateViewFacts < ActiveRecord::Migration | |
def up | |
create_view :facts, " | |
SELECT c.id, c.created_at, c.name, c.description_html, c.link, c.mobilization_id, 'campaigns' as relname FROM campaigns c | |
UNION ALL | |
SELECT p.id, p.created_at, p.name, p.description as description_html, p.link, p.mobilization_id, 'problems' as relname FROM problems p;" | |
end | |
def down | |
drop_view :facts | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment