Skip to content

Commit 72d9a46

Browse files
authored
Fix diesel schema patch file update instructions (#11053)
`patch -o` does not appear to work quite as intended on my machine, so let's adjust the instructions to make them actually work correctly. This also introduces `--label` arguments to the `diff` call, to avoid the unnecessary datetime headers.
1 parent 8ce85dd commit 72d9a46

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

crates/crates_io_database/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ regular tables, so we have to manually add them to the schema file.
2020
If you need to update the patch file, you can do so by following these steps:
2121

2222
1. prefix `patch_file = "src/schema.patch"` in `diesel.toml` with a `#` to comment it out.
23-
2. use `diesel print-schema` and save the output to `src/schema.rs.orig`
24-
3. use `patch -o src/schema.rs src/schema.rs.orig src/schema.patch` to apply the patch file and solve remaining issues in the `src/schema.rs` file
25-
4. use `diff -Naur src/schema.rs.orig src/schema.rs` to generate the new content for the `src/schema.patch` file
26-
5. enable the `patch_file` option in the `diesel.toml` file again.
23+
2. use `diesel print-schema` and save the output to `src/schema.rs`
24+
3. use `cp src/schema.rs src/schema.rs.orig` to create a backup of the original file
25+
4. use `patch src/schema.rs src/schema.patch` to apply the patch file and solve remaining issues in the `src/schema.rs` file
26+
5. use `diff -Naur --label original --label patched src/schema.rs.orig src/schema.rs` to generate the new content for the `src/schema.patch` file
27+
6. enable the `patch_file` option in the `diesel.toml` file again.

crates/crates_io_database/src/schema.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
--- crates/crates_io_database/schema.rs.orig 2024-03-04 10:34:35
2-
+++ crates/crates_io_database/schema.rs 2024-03-04 10:33:35
1+
--- original
2+
+++ patched
33
@@ -21,9 +21,7 @@
44
/// The `pg_catalog.tsvector` SQL type
55
///

0 commit comments

Comments
 (0)