Skip to content

Commit f636fe2

Browse files
Merge #1489
1489: Regenerate `schema.patch` r=sgrif a=sgrif The PR adding an ltree column was originally opened before the updates to Diesel CLI, and merged after. The changes to schema.rs affected the context lines used by the patch file to anchor the `recent_crate_downloads` view, causing the schema patch to fail to be applied. This regenerates that file, so we should avoid this problem in the future. There are a few longer term things that need to happen. - Diesel CLI needs a flag to error if the schema changes, rather than regenerating the file. This would also error if the patch file failed to apply. This feature will be in 1.4, and I will try to prioritize implementing it. We will want to use this flag in CI and deploys - Diesel CLI needs a better workflow for resolving merge conflicts. I'm not entirely sure what this should look like, but it should probably at least start with a `--regenerate-patch-file` flag or something along those lines to automate this when conflicts do occur. - Diesel should have a better story for importing views, since that's the piece of this that is most likely to conflict. Co-authored-by: Sean Griffin <[email protected]>
2 parents f58ca05 + 508ed31 commit f636fe2

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/schema.patch

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
diff --git a/src/schema.rs b/src/schema.rs
2+
index df884e4..18e08cd 100644
13
--- a/src/schema.rs
24
+++ b/src/schema.rs
3-
@@ -1,5 +1,7 @@
5+
@@ -1,6 +1,8 @@
46
+#![allow(unused_imports)]
57
+
68
table! {
79
use diesel::sql_types::*;
810
use diesel_full_text_search::{TsVector as Tsvector};
11+
use diesel_ltree::Ltree;
912

1013
/// Representation of the `api_tokens` table.
11-
@@ -588,10 +590,28 @@ table! {
14+
@@ -608,12 +610,30 @@ table! {
15+
/// (Automatically generated by Diesel.)
1216
rendered_at -> Timestamp,
1317
}
1418
}
@@ -34,10 +38,12 @@
3438
+table! {
3539
use diesel::sql_types::*;
3640
use diesel_full_text_search::{TsVector as Tsvector};
41+
use diesel_ltree::Ltree;
3742

3843
/// Representation of the `reserved_crate_names` table.
3944
///
40-
@@ -849,21 +869,23 @@ table! {
45+
@@ -881,22 +901,24 @@ table! {
46+
}
4147

4248
joinable!(api_tokens -> users (user_id));
4349
joinable!(crate_downloads -> crates (crate_id));
@@ -62,7 +68,8 @@
6268
joinable!(version_downloads -> versions (version_id));
6369
joinable!(versions -> crates (crate_id));
6470

65-
@@ -881,10 +903,11 @@ allow_tables_to_appear_in_same_query!(
71+
@@ -913,12 +935,13 @@ allow_tables_to_appear_in_same_query!(
72+
dependencies,
6673
emails,
6774
follows,
6875
keywords,
@@ -74,3 +81,4 @@
7481
users,
7582
version_authors,
7683
version_downloads,
84+
versions,

src/schema.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ table! {
8282
use diesel::sql_types::*;
8383
use diesel_full_text_search::{TsVector as Tsvector};
8484
use diesel_ltree::Ltree;
85-
use diesel::sql_types::*;
8685

8786
/// Representation of the `categories` table.
8887
///

0 commit comments

Comments
 (0)