safe_migrate/model/column.rs
1use crate::analysis::expr_ir::ExprIr;
2use crate::ast::identifiers::ObjectId;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6pub struct Column {
7 pub name: String,
8 pub data_type: Option<String>,
9 /// Resolved identity for a tracked user-defined type. The display spelling
10 /// remains for reports and cache compatibility; state transitions use this
11 /// identity so same-named types in different schemas stay distinct.
12 #[serde(skip)]
13 pub type_id: Option<ObjectId>,
14 pub is_nullable: bool,
15 pub default: Option<ExprIr>,
16 pub avg_width: Option<i32>,
17 /// Raw default expression text from pg_get_expr(), unparsed.
18 /// Used for display and heuristic volatility checks without an ExprIr parser.
19 #[serde(default)]
20 pub default_expr_text: Option<String>,
21 /// Raw type modifier integer from pg_attribute.atttypmod.
22 /// For VARCHAR(50), PostgreSQL stores the character limit plus VARHDRSZ: 54.
23 #[serde(default)]
24 pub type_modifier: Option<i32>,
25}