diesel icon indicating copy to clipboard operation
diesel copied to clipboard

Fixed build error installing the diesel_cli with barrel-migrations

Open 0xc0deface opened this issue 4 years ago • 7 comments

I found that cargo install diesel_cli --no-default-features --features="barrel-migrations sqlite" was not working due to something on crates using a very old version. So i tried installing from git master directly with this command which also failed: cargo install --git https://github.com/diesel-rs/diesel.git diesel_cli --no-default-features --features="barrel-migrations sqlite"

This was because barrel didnt have a specific feature for the requested backend selected. Unfortunately cargo wont let us conditionally add feature barrel/sqlite3 et al from the sqlite feature when barrel-migrations is enabled. however, as barrel only supports one backend at a time, this isnt a huge issue and we can just make a barrel-migrations feature for each of the backends. This means that rather than specifying --features="barrel-migrations sqlite" you would just specify --features="barrel-migrations-sqlite"

To test this installs you can try installing directly from my fork with: cargo install --git https://github.com/0xc0deface/diesel.git diesel_cli --no-default-features --features=barrel-migrations-sqlite

Cheers.

0xc0deface avatar Jun 09 '20 05:06 0xc0deface

Duplicate of #2409?

weiznich avatar Jun 09 '20 06:06 weiznich

Sure looks like they are doing similar things, without the baggage of the rest of the change though. Also interesting to see how people working separately can arrive at very similar results.

There is an issue with this PR where it isn't activating the barrel feature of migration_internals. This is why its building but subsequently doesn't work when you try to run a migration.

Barrel will need to change the version number of diesel they use to be compatible with 2.0.0 before that error goes away, so this patch is less broken, but still broken.

I can fix that, and also make a PR on barrel to bump the diesel version, unless you would prefer to let this get handled by the existing PR?

0xc0deface avatar Jun 09 '20 10:06 0xc0deface

Please coordinate those with @pksunkara

weiznich avatar Jun 09 '20 14:06 weiznich

@0xc0deface What other changes are you planning?

pksunkara avatar Jun 09 '20 19:06 pksunkara

You can see this commit for the barrel related changes that need to make it work for my diesel PR.

pksunkara avatar Jun 09 '20 19:06 pksunkara

@pksunkara well none really. The only reason to pursue this PR rather than yours is if yours will take longer to get approved and merged, as my change is more minimal. Do you have an ETA on when your PR will be merged?

0xc0deface avatar Jun 10 '20 06:06 0xc0deface

My PR is more for diesel 2.0. if you want something fast, you might backport the features change to 1.4.x branch

pksunkara avatar Jun 10 '20 07:06 pksunkara

Closed as the barrel integration is removed.

weiznich avatar Aug 29 '22 15:08 weiznich