Skip to content

Commit

Permalink
Update decennial.sql to use INDEX_NAME variable to create geoid index
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarchena committed Feb 6, 2024
1 parent 5837e98 commit fac0a48
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion migrations/decennial.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CREATE SCHEMA IF NOT EXISTS decennial;
DROP TABLE IF EXISTS decennial.:"TABLE_NAME";
DROP INDEX IF EXISTS decennial.:INDEX_NAME;

CREATE TEMP TABLE tmp (
year text,
Expand All @@ -11,4 +12,6 @@ CREATE TEMP TABLE tmp (
\COPY tmp FROM PSTDIN WITH DELIMITER ',' CSV HEADER;

DROP TABLE IF EXISTS decennial.:"TABLE_NAME";
SELECT * INTO decennial.:"TABLE_NAME" FROM tmp;
SELECT * INTO decennial.:"TABLE_NAME" FROM tmp;

CREATE INDEX IF NOT EXISTS :INDEX_NAME ON decennial.:"TABLE_NAME" (geoid);

0 comments on commit fac0a48

Please sign in to comment.