Created
August 26, 2018 20:57
-
-
Save danielfone/16b70cee3b31b69397a3c350d707ff7f 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
-- Load projects from import | |
-- | |
INSERT INTO projects (reference, name, created_at, updated_at) | |
SELECT | |
i.project_reference AS reference, | |
i.project_name AS name | |
now() AS created_at, | |
now() AS updated_at | |
FROM (SELECT DISTINCT project_reference, project_name FROM imported_reports) i | |
ON CONFLICT (reference) DO UPDATE SET | |
name = excluded.name, | |
updated_at = NOW() | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment