ic_dbms_api/dbms/table/
column_def.rs

1use crate::dbms::types::DataTypeKind;
2
3/// Defines a column in a database table.
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub struct ColumnDef {
6    /// The name of the column.
7    pub name: &'static str,
8    /// The data type of the column.
9    pub data_type: DataTypeKind,
10    /// Indicates if this column can contain NULL values.
11    pub nullable: bool,
12    /// Indicates if this column is part of the primary key.
13    pub primary_key: bool,
14    /// Foreign key definition, if any.
15    pub foreign_key: Option<ForeignKeyDef>,
16}
17
18/// Defines a foreign key relationship for a column.
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub struct ForeignKeyDef {
21    /// Name of the local column that holds the foreign key (es: "user_id")
22    pub local_column: &'static str,
23    /// Name of the foreign table (e.g., "users")
24    pub foreign_table: &'static str,
25    /// Name of the foreign column that the FK points to (e.g., "id")
26    pub foreign_column: &'static str,
27}