Skip to content

Commit

Permalink
Merge #1489
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
bors-voyager[bot] and sgrif committed Sep 11, 2018
2 parents f58ca05 + 508ed31 commit f636fe2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/schema.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
diff --git a/src/schema.rs b/src/schema.rs
index df884e4..18e08cd 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -1,5 +1,7 @@
@@ -1,6 +1,8 @@
+#![allow(unused_imports)]
+
table! {
use diesel::sql_types::*;
use diesel_full_text_search::{TsVector as Tsvector};
use diesel_ltree::Ltree;

/// Representation of the `api_tokens` table.
@@ -588,10 +590,28 @@ table! {
@@ -608,12 +610,30 @@ table! {
/// (Automatically generated by Diesel.)
rendered_at -> Timestamp,
}
}
Expand All @@ -34,10 +38,12 @@
+table! {
use diesel::sql_types::*;
use diesel_full_text_search::{TsVector as Tsvector};
use diesel_ltree::Ltree;

/// Representation of the `reserved_crate_names` table.
///
@@ -849,21 +869,23 @@ table! {
@@ -881,22 +901,24 @@ table! {
}

joinable!(api_tokens -> users (user_id));
joinable!(crate_downloads -> crates (crate_id));
Expand All @@ -62,7 +68,8 @@
joinable!(version_downloads -> versions (version_id));
joinable!(versions -> crates (crate_id));

@@ -881,10 +903,11 @@ allow_tables_to_appear_in_same_query!(
@@ -913,12 +935,13 @@ allow_tables_to_appear_in_same_query!(
dependencies,
emails,
follows,
keywords,
Expand All @@ -74,3 +81,4 @@
users,
version_authors,
version_downloads,
versions,
1 change: 0 additions & 1 deletion src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ table! {
use diesel::sql_types::*;
use diesel_full_text_search::{TsVector as Tsvector};
use diesel_ltree::Ltree;
use diesel::sql_types::*;

/// Representation of the `categories` table.
///
Expand Down

0 comments on commit f636fe2

Please sign in to comment.