Macro diesel::infer_schema
[−]
[src]
macro_rules! infer_schema { ($database_url: expr) => { ... }; ($database_url: expr, $schema_name: expr) => { ... }; }
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.
This macro can only be used in combination with the diesel_codegen crate.
It will not work on its own.
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.