fn unify_primary_and_foreign_column(&self, columns: &[Column]) -> Vec<Column> {
        let mut unified_columns = Vec::new();
        let mut primary_columns = Vec::new();
        let mut foreign_columns = Vec::new();
        for c in columns {
            if c.is_primary {
                primary_columns.push(c.name.clone());
            }
            if c.foreign.is_some() {
                foreign_columns.push(c.name.clone());
            }
        }
        // if both primary and foreign, push only the modified foreign
        for c in columns {
            if primary_columns.contains(&c.name) && foreign_columns.contains(&c.name) {
                if c.foreign.is_some() {
                    let mut clone_column = c.clone();
                    clone_column.is_primary = true;
                    unified_columns.push(clone_column);
                }
            } else {
                unified_columns.push(c.clone());
            }
        }
        unified_columns

    }
/// column that is both primary and foreign should be unified
column that is both primary and foreign should be unified
column that is both primary and foreign should be unified
fn unify_primary_and_foreign_column(&self, columns: &[Column]) -> Vec<Column> {
        let mut unified_columns = Vec::new();
        let mut primary_columns = Vec::new();
        let mut foreign_columns = Vec::new();
        for c in columns {
            if c.is_primary {
                primary_columns.push(c.name.clone());
            }
            if c.foreign.is_some() {
                foreign_columns.push(c.name.clone());
            }
        }
        // if both primary and foreign, push only the modified foreign
        for c in columns {
            if primary_columns.contains(&c.name) && foreign_columns.contains(&c.name) {
                if c.foreign.is_some() {
                    let mut clone_column = c.clone();
                    clone_column.is_primary = true;
                    unified_columns.push(clone_column);
                }
            } else {
                unified_columns.push(c.clone());
            }
        }
        unified_columns
    }
fn unify_primary_and_foreign_column ( & self , columns : & [ Column ] ) -> Vec < Column > { let mut unified_columns = Vec :: new ( ) ; let mut primary_columns = Vec :: new ( ) ; let mut foreign_columns = Vec :: new ( ) ; for c in columns { if c . is_primary { primary_columns . push ( c . name . clone ( ) ) ; } if c . foreign . is_some ( ) { foreign_columns . push ( c . name . clone ( ) ) ; } } // if both primary and foreign, push only the modified foreign for c in columns { if primary_columns . contains ( & c . name ) && foreign_columns . contains ( & c . name ) { if c . foreign . is_some ( ) { let mut clone_column = c . clone ( ) ; clone_column . is_primary = true ; unified_columns . push ( clone_column ) ; } } else { unified_columns . push ( c . clone ( ) ) ; } } unified_columns }
column that is both primary and foreign should be unified
column that is both primary and foreign should be unified
&self
columns
&[Column]
&self
columns
&[Column]