isPrimaryKey checks if a column is part of the table's primary key. TODO: This function uses direct string comparison (indexColumn.ColumnName() == column.name.Name) instead of quote-aware comparison via identsEqual(). This could cause incorrect results when the column name and index column name hav
(column Column, table Table)
| 3801 | // cause issues in offline mode where SQL is parsed directly without database normalization. |
| 3802 | // Consider using g.identsEqual() or normalizeIdentKey() for correctness. |
| 3803 | func (g *Generator) isPrimaryKey(column Column, table Table) bool { |
| 3804 | if column.keyOption == ColumnKeyPrimary { |
| 3805 | return true |
| 3806 | } |
| 3807 | |
| 3808 | for _, index := range table.indexes { |
| 3809 | if index.primary { |
| 3810 | for _, indexColumn := range index.columns { |
| 3811 | if indexColumn.ColumnName() == column.name.Name { |
| 3812 | return true |
| 3813 | } |
| 3814 | } |
| 3815 | } |
| 3816 | } |
| 3817 | return false |
| 3818 | } |
| 3819 | |
| 3820 | // Destructively modify table1 to have table2 columns/indexes |
| 3821 | func mergeTable(table1 *Table, table2 Table) { |
no test coverage detected