pub use drizzle_types::sqlite::ddl::*;
#[derive(Debug, Clone, Default)]
pub struct ParsedTable {
pub strict: bool,
pub without_rowid: bool,
pub uniques: Vec<ParsedUnique>,
}
#[must_use]
pub fn parse_table_ddl(sql: &str) -> ParsedTable {
let sql_upper = sql.to_uppercase();
ParsedTable {
strict: sql_upper.contains(" STRICT"),
without_rowid: sql_upper.contains("WITHOUT ROWID"),
uniques: Vec::new(), }
}
#[derive(Debug, Clone)]
pub struct ParsedGenerated {
pub expression: String,
pub gen_type: GeneratedType,
}
#[derive(Debug, Clone)]
pub struct ParsedUnique {
pub name: Option<String>,
pub columns: Vec<String>,
}
#[derive(Debug, Clone)]
pub struct ParsedForeignKey {
pub name: Option<String>,
pub columns: Vec<String>,
pub table_to: String,
pub columns_to: Vec<String>,
pub on_delete: Option<String>,
pub on_update: Option<String>,
}
#[derive(Debug, Clone)]
pub struct ParsedPrimaryKey {
pub columns: Vec<String>,
pub autoincrement: bool,
}
#[derive(Debug, Clone)]
pub struct ParsedCheck {
pub name: Option<String>,
pub expression: String,
}