Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upCLI: Add a subcommand to print db schema as `table!` calls #437
Comments
killercup
added
discussion desired
cli
labels
Sep 12, 2016
This comment has been minimized.
|
Would be a great addition, as I write a new Postgresql-rust/Nickel project, based on an existent MySQL-PHP project with dozens of tables. |
This comment has been minimized.
|
@iamsebastian Is there a reason you're unable to use |
This comment has been minimized.
|
Am I able to print out the schema with the |
This comment has been minimized.
|
No, what I mean is that I'm curious why you need to print out the schema instead of inferring it. |
This comment has been minimized.
|
Because sometimes, as I started to use rust & diesel.rs, I struggled around if I had chosen the correct types, that match the types defined in the different postgres-tables (I migrated freshly to a postgres database from our mysql-production database). |
This comment has been minimized.
bronson
commented
Nov 22, 2016
|
I also hope for the ability to print the schema. Rails's Committing |
This comment has been minimized.
marcusball
commented
Dec 12, 2016
|
Regarding a reason why one might not want to use I wanted to write a small utility for an existing production database, so I decided to try diesel for it. However, |
This comment has been minimized.
|
|
weiznich
referenced this issue
Jan 13, 2017
Merged
Initial version of infer-schema as cli subcommand #577
This comment has been minimized.
|
Let's say that I have to build my project in some environment that, for reason or another, I'm unable to install Postgres in. Does this make possible for me to print the schema as rust source code in my dev environment, and distribute that as a source code file to get rid of the Postgres dependency in the build environment? |
This comment has been minimized.
|
Yes, @golddranks. Only the (Of course, you'll need to personally make sure your db schema is correct/up-to-date if you don't use the |
This comment has been minimized.
|
Just to expand on that, I do want to provide a function that verifies that the schema matches what is expected at runtime |
killercup commentedSep 12, 2016
I've been thinking about adding a
diesel_clisubcommand to useinfer_schemato print out the current schema as calls totable!.The motivation is that for a large application I'd want to have the current schema somewhere in the repo and not just be the result of a bunch of migrations. (This might make it easier to join an existing diesel project as well.)
First draft for the CLI usage: