Skip to main content

build_modify_column_default

Function build_modify_column_default 

Source
pub fn build_modify_column_default(
    backend: DatabaseBackend,
    table: &str,
    column: &str,
    new_default: Option<&str>,
    backfill: Option<&str>,
    current_schema: &[TableDef],
    pending_constraints: &[TableConstraint],
) -> Result<Vec<BuiltQuery>, QueryError>
Expand description

Build SQL for changing column default value.

When backfill is Some(value), an UPDATE statement is appended after the schema-level change so every existing row is rewritten to the given value (F15 backfill option β). The update uses identifier quoting appropriate for the backend and treats value as a raw SQL expression (already-quoted literals for strings, bare expressions like NOW() for functions). When backfill is None the action behaves exactly as in v0.2.0 — only the schema is touched, existing rows keep their values.