pub struct DatabaseConfig {Show 13 fields
pub dialect: Dialect,
pub schema: Schema,
pub out: PathBuf,
pub breakpoints: bool,
pub driver: Option<Driver>,
pub tables_filter: Option<Filter>,
pub schema_filter: Option<Filter>,
pub extensions_filters: Option<Vec<Extension>>,
pub entities: Option<EntitiesFilter>,
pub casing: Option<Casing>,
pub introspect: Option<IntrospectConfig>,
pub verbose: bool,
pub migrations: Option<MigrationsOpts>,
/* private fields */
}Expand description
Settings for one database: the top level of a single-database config,
or one [databases.<name>] table.
Field names match drizzle-kit (dbCredentials, tablesFilter, …).
Fields§
§dialect: DialectDatabase dialect (required)
schema: SchemaSchema file paths or glob patterns, relative to the config file.
out: PathBufMigrations folder (default ./drizzle), relative to the config file.
breakpoints: boolWhether to use SQL breakpoints in migrations (default: true)
driver: Option<Driver>Database driver for Rust connections
tables_filter: Option<Filter>Table name filter (glob patterns supported)
schema_filter: Option<Filter>Schema name filter (PostgreSQL only)
extensions_filters: Option<Vec<Extension>>Extensions filter (PostgreSQL only, e.g., ["postgis"])
entities: Option<EntitiesFilter>Entities filter (roles, etc.)
casing: Option<Casing>Casing preference for generated names. Currently ignored when building snapshots: table macros always snake_case inferred names.
introspect: Option<IntrospectConfig>Introspection configuration
verbose: boolVerbose output
migrations: Option<MigrationsOpts>Migration table configuration
Implementations§
Source§impl DatabaseConfig
impl DatabaseConfig
Sourcepub fn credentials(&self) -> Result<Option<Credentials>, Error>
pub fn credentials(&self) -> Result<Option<Credentials>, Error>
Returns typed credentials, reading any { env = "VAR" } values.
Returns None when dbCredentials is absent or its shape does not
fit the dialect (loading a config already rejects most such
mismatches).
§Errors
Returns Error if a referenced environment variable is unset or not
valid UTF-8, or an ssl value is not a recognized mode.
Sourcepub fn migrations_dir(&self) -> &Path
pub fn migrations_dir(&self) -> &Path
Returns the migrations folder (out).
Sourcepub fn meta_dir(&self) -> PathBuf
pub fn meta_dir(&self) -> PathBuf
Returns out/meta, where legacy drizzle-kit layouts keep the journal.
Sourcepub fn journal_path(&self) -> PathBuf
pub fn journal_path(&self) -> PathBuf
Returns the legacy out/meta/_journal.json path.
Sourcepub fn schema_display(&self) -> String
pub fn schema_display(&self) -> String
Returns the schema paths joined for display.
Sourcepub fn schema_files(&self) -> Result<Vec<PathBuf>, Error>
pub fn schema_files(&self) -> Result<Vec<PathBuf>, Error>
Resolves schema paths and globs to files.
§Errors
Returns Error if a listed path is missing, if a glob pattern is
invalid, fails to expand or matches no file (see
resolve_schema_patterns), or if nothing is listed at all.
Sourcepub fn effective_casing(&self) -> Casing
pub fn effective_casing(&self) -> Casing
Returns casing, or camelCase when unset.
Sourcepub fn effective_introspect_casing(&self) -> IntrospectCasing
pub fn effective_introspect_casing(&self) -> IntrospectCasing
Returns introspect.casing, or camel when unset.
Sourcepub fn effective_entities(&self) -> EntitiesFilter
pub fn effective_entities(&self) -> EntitiesFilter
Returns the entities filter, or the default when unset.
Sourcepub fn should_include_role(&self, role_name: &str) -> bool
pub fn should_include_role(&self, role_name: &str) -> bool
Returns true if role_name passes the entities.roles filter
(false when no entities filter is set).
Sourcepub fn roles_enabled(&self) -> bool
pub fn roles_enabled(&self) -> bool
Returns true if the entities.roles filter is enabled.
Sourcepub fn extensions(&self) -> &[Extension]
pub fn extensions(&self) -> &[Extension]
Returns the extensionsFilters list (PostgreSQL only; empty when
unset).
Sourcepub fn has_extension(&self, ext: Extension) -> bool
pub fn has_extension(&self, ext: Extension) -> bool
Returns true if ext is in extensionsFilters.
Sourcepub fn migrations_table(&self) -> &str
pub fn migrations_table(&self) -> &str
Returns the migrations tracking table (default __drizzle_migrations).
Sourcepub fn migrations_schema(&self) -> &str
pub fn migrations_schema(&self) -> &str
Returns the migrations tracking schema (PostgreSQL only, default
drizzle).
Sourcepub fn bundle_enabled(&self) -> bool
pub fn bundle_enabled(&self) -> bool
Should a bundled migrations.js index be emitted alongside migration.sql?
Resolution order:
- Explicit
[migrations] bundle = true/falsein the config wins. - Otherwise, auto-enable for
driver = "durable-sqlite"since Durable Objects need the JS index to import migrations at Worker build time (there’s no other way to ship SQL into a DO). - Otherwise, default to
false.
Trait Implementations§
Source§impl Clone for DatabaseConfig
impl Clone for DatabaseConfig
Source§impl Debug for DatabaseConfig
impl Debug for DatabaseConfig
Source§impl<'de> Deserialize<'de> for DatabaseConfig
impl<'de> Deserialize<'de> for DatabaseConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for DatabaseConfig
impl JsonSchema for DatabaseConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more