Skip to content

Commit

Permalink
Auto merge of #3612 - jtgeibel:drop-tsvector-from-db-export, r=pietro…
Browse files Browse the repository at this point in the history
…albini

Drop crates.textsearchable_index_col from the export

This column is postgres specific and is normally populated via a
trigger. The trigger is now enabled during the import so that the column
can be dropped from the export.

This addresses part of what was raised in bullet point 2 of #2078. The large readme column remains because there could be people using that data, but the text search column is redundant.

r? `@smarnach`
cc `@kornelski`
  • Loading branch information
bors committed May 14, 2021
2 parents 090d1c9 + 8fb7d30 commit e421caa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tasks/dump_db/dump-db.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ description = "public"
homepage = "public"
documentation = "public"
readme = "public"
textsearchable_index_col = "public"
textsearchable_index_col = "private" # This Postgres specific and can be derived from exported data
repository = "public"
max_upload_size = "public"

Expand Down
3 changes: 3 additions & 0 deletions src/tasks/dump_db/dump-import.sql.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ BEGIN;
TRUNCATE "{{this.name}}" RESTART IDENTITY CASCADE;
{{~/each}}

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

-- Import the CSV data.
{{~#each tables}}
\copy "{{this.name}}" ({{this.columns}}) FROM 'data/{{this.name}}.csv' WITH CSV HEADER
Expand Down

0 comments on commit e421caa

Please sign in to comment.