Skip to main content

DEFAULT

Constant DEFAULT 

Source
pub const DEFAULT: ColumnMarker;
Expand description

Specifies a database DEFAULT clause for new rows.

ยงExample

#[column(DEFAULT = 0)]
count: i32,

#[column(DEFAULT = "guest")]
role: String,

#[column(DEFAULT = now())]
created_at: chrono::NaiveDateTime,

String literals are quoted SQL values. SQL keywords and function calls are emitted as database expressions. For application-generated values, use DEFAULT_FN instead.

See: https://www.postgresql.org/docs/current/ddl-default.html