(tables schema.Tables)
| 29 | } |
| 30 | |
| 31 | func (*Client) normalizeColumns(tables schema.Tables) schema.Tables { |
| 32 | normalized := make(schema.Tables, 0, len(tables)) |
| 33 | for _, table := range tables { |
| 34 | normalizedTable := *table |
| 35 | normalizedTable.Columns = make(schema.ColumnList, len(table.Columns)) |
| 36 | for i := range table.Columns { |
| 37 | normalizedColumn := table.Columns[i] |
| 38 | if keyListColumn(normalizedColumn) { |
| 39 | normalizedColumn.Type = duckDBToArrow("varchar") |
| 40 | } |
| 41 | // In DuckDB, a PK column must be NOT NULL, so we need to make sure that the schema we're comparing to has the same |
| 42 | // constraint. |
| 43 | if normalizedColumn.PrimaryKey { |
| 44 | normalizedColumn.NotNull = true |
| 45 | } |
| 46 | // Since multiple schema types can map to the same duckdb type we need to normalize them to avoid false positives when detecting schema changes |
| 47 | normalizedColumn.Type = duckDBToArrow(arrowToDuckDB(normalizedColumn.Type)) |
| 48 | normalizedTable.Columns[i] = normalizedColumn |
| 49 | } |
| 50 | normalized = append(normalized, &normalizedTable) |
| 51 | } |
| 52 | |
| 53 | return normalized |
| 54 | } |
| 55 | |
| 56 | func (c *Client) nonAutoMigratableTables(tables schema.Tables, duckdbTables schema.Tables) map[string][]schema.TableColumnChange { |
| 57 | result := make(map[string][]schema.TableColumnChange) |
no test coverage detected