Created
December 6, 2019 04:37
-
-
Save sleepingkingstudios/29af5584cb7957de357b88604722ec83 to your computer and use it in GitHub Desktop.
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
ApplicationRecord.connection.execute( | |
<<~SQL | |
CREATE TEMPORARY TABLE IF NOT EXISTS gadgets | |
( | |
id bigint NOT NULL, | |
name varchar(64) NOT NULL | |
); | |
CREATE TEMPORARY SEQUENCE IF NOT EXISTS gadgets_id_seq | |
START WITH 1 | |
INCREMENT BY 1 | |
NO MINVALUE | |
NO MAXVALUE | |
CACHE 1; | |
ALTER SEQUENCE gadgets_id_seq OWNED BY gadgets.id; | |
ALTER TABLE ONLY gadgets | |
ALTER COLUMN id | |
SET DEFAULT nextval('gadgets_id_seq'::regclass); | |
SQL | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment