Skip to content

Commit cd217af

Browse files
committed
dump_db: Remove handlebars whitespace control characters
1 parent 76450c6 commit cd217af

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/tasks/dump_db/dump-export.sql.hbs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
BEGIN ISOLATION LEVEL REPEATABLE READ, READ ONLY;
2-
{{~#each tables}}
3-
{{~#if this.filter}}
2+
{{#each tables}}
3+
{{#if this.filter}}
44
\copy (SELECT {{this.columns}} FROM "{{this.name}}" WHERE {{this.filter}}) TO 'data/{{this.name}}.csv' WITH CSV HEADER
5-
{{~else}}
5+
{{else}}
66
\copy "{{this.name}}" ({{this.columns}}) TO 'data/{{this.name}}.csv' WITH CSV HEADER
7-
{{~/if}}
8-
{{~/each}}
7+
{{/if}}
8+
{{/each}}
99
COMMIT;

src/tasks/dump_db/dump-import.sql.hbs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
BEGIN;
22
-- Disable triggers on each table.
3-
{{~#each tables}}
3+
{{#each tables}}
44
ALTER TABLE "{{this.name}}" DISABLE TRIGGER ALL;
5-
{{~/each}}
5+
{{/each}}
66

77
-- Set defaults for non-nullable columns not included in the dump.
8-
{{~#each tables as |table|}}
9-
{{~#each column_defaults}}
8+
{{#each tables as |table|}}
9+
{{#each column_defaults}}
1010
ALTER TABLE "{{table.name}}" ALTER COLUMN "{{@key}}" SET DEFAULT {{this}};
11-
{{~/each}}
12-
{{~/each}}
11+
{{/each}}
12+
{{/each}}
1313

1414
-- Truncate all tables.
15-
{{~#each tables}}
15+
{{#each tables}}
1616
TRUNCATE "{{this.name}}" RESTART IDENTITY CASCADE;
17-
{{~/each}}
17+
{{/each}}
1818

1919
-- Enable this trigger so that `crates.textsearchable_index_col` can be excluded from the export
2020
ALTER TABLE "crates" ENABLE TRIGGER "trigger_crates_tsvector_update";
2121

2222
-- Import the CSV data.
23-
{{~#each tables}}
23+
{{#each tables}}
2424
\copy "{{this.name}}" ({{this.columns}}) FROM 'data/{{this.name}}.csv' WITH CSV HEADER
25-
{{~/each}}
25+
{{/each}}
2626

2727
-- Drop the defaults again.
28-
{{~#each tables as |table|}}
29-
{{~#each column_defaults}}
28+
{{#each tables as |table|}}
29+
{{#each column_defaults}}
3030
ALTER TABLE "{{table.name}}" ALTER COLUMN "{{@key}}" DROP DEFAULT;
31-
{{~/each}}
32-
{{~/each}}
31+
{{/each}}
32+
{{/each}}
3333

3434
-- Reenable triggers on each table.
35-
{{~#each tables}}
35+
{{#each tables}}
3636
ALTER TABLE "{{this.name}}" ENABLE TRIGGER ALL;
37-
{{~/each}}
37+
{{/each}}
3838
COMMIT;

0 commit comments

Comments
 (0)