[−][src]Macro diesel_infer_schema::infer_schema
Diesel CLI can be configured to automatically run print-schema
after running migrations. See diesel.rs/guides/configuring-diesel-cli for details.
Queries the database for the names of all tables, and calls
infer_table_from_schema!
for each
one. A schema name can optionally be passed to load from schemas other than
the default. If a schema name is given, the inferred tables will be wrapped
in a module with the same name.
Attempting to use the env!
or dotenv!
macros here will not work due to
limitations of the Macros 1.1 system, but you can pass a string in the form
"env:SOME_ENV_VAR"
or "dotenv:SOME_ENV_VAR"
to achieve the same effect.
If any column name would collide with a rust keyword, a _
will
automatically be placed at the end of the name. For example, a column called
type
will be referenced as type_
in the generated module.