Skip to content

Commit ed87d18

Browse files
committed
Auto merge of #3912 - Turbo87:handlebars, r=locks
Update `handlebars` crate to v4.1.3 see https://github.com/sunng87/handlebars-rust/blob/master/CHANGELOG.md ~It looks like none of the breaking changes in the v4 release are relevant to us.~ Update: I was wrong, sunng87/handlebars-rust#404 does affect us. I've added another commit which removes the now problematic handlebars whitespace control characters.
2 parents ee04493 + 030a8fb commit ed87d18

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ flate2 = "1.0"
5959
futures-channel = { version = "0.3.1", default-features = false }
6060
futures-util = "0.3"
6161
git2 = "0.13.0"
62-
handlebars = "3.0.1"
62+
handlebars = "4.1.3"
6363
hex = "0.4"
6464
htmlescape = "0.3.1"
6565
http = "0.2"

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)