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 = CURRENT_TIMESTAMP)]
created_at: String,

#[column(default = strftime("%s", "now"))]
created_at_unix: i64,

For application-generated values such as UUIDs, use DEFAULT_FN instead.

See: https://sqlite.org/lang_createtable.html#the_default_clause