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
messages = Message.arel_table | |
messages2 = Message.arel_table.alias('messages2') | |
messages3 = Message.arel_table.alias('messages3') | |
users = User.arel_table | |
manager = Arel::SelectManager.new(Message.arel_engine) | |
manager.project users[:first_name], users[:last_name], messages[:created_at] | |
manager.from messages | |
manager.join(messages2, Arel::Nodes::OuterJoin).on(messages[:created_at].eq(messages2[:created_at])) | |
manager.join(messages3, Arel::Nodes::OuterJoin).on(messages[:recipient_id].eq(messages3[:recipient_id])) | |
manager.join(users).on(users[:id].eq(messages[:sender_id])) |
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
UPDATE pg_database SET datallowconn = TRUE WHERE datname = 'template0'; | |
\c template0 | |
UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1'; | |
DROP DATABASE template1; | |
CREATE DATABASE template1 WITH TEMPLATE = 'template0'; | |
\c template1 | |
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1'; | |
UPDATE pg_database SET datallowconn = FALSE WHERE datname = 'template0'; |