toasty_sql/stmt/
column_def.rs

1use toasty_core::{
2    driver,
3    schema::db::{self, Column},
4};
5
6#[derive(Debug, Clone)]
7pub struct ColumnDef {
8    pub name: String,
9    pub ty: db::Type,
10    pub not_null: bool,
11    pub auto_increment: bool,
12}
13
14impl ColumnDef {
15    pub(crate) fn from_schema(column: &Column, _storage_types: &driver::StorageTypes) -> Self {
16        Self {
17            name: column.name.clone(),
18            ty: column.storage_ty.clone(),
19            not_null: !column.nullable,
20            auto_increment: column.auto_increment,
21        }
22    }
23}