diff --git a/src/migrations/create_table.rs b/src/migrations/create_table.rs index 066dbd8..8178c5f 100644 --- a/src/migrations/create_table.rs +++ b/src/migrations/create_table.rs @@ -75,6 +75,8 @@ impl Action for CreateTable { fn update_schema(&self, schema: &mut Schema) -> anyhow::Result<()> { let mut table = Table::new(self.name.to_string()); + table.primary_key = self.primary_key.clone(); + for column in &self.columns { table.add_column(crate::schema::Column { name: column.name.to_string(), diff --git a/src/schema.rs b/src/schema.rs index 3817ef1..41a6217 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -42,6 +42,7 @@ impl Default for Schema { pub struct Table { pub name: String, pub columns: Vec, + pub primary_key: Vec, #[serde(skip)] pub has_is_new: bool, } @@ -50,6 +51,7 @@ impl Table { pub fn new(name: impl Into) -> Table { Table { name: name.into(), + primary_key: vec![], columns: vec![], has_is_new: false, }