~rbn/rom unlisted

0d529953e1e34fbf329ed2010e29c760506fdcb4 — Ruben Schuller 3 months ago 0e3c643 v0.0.18
fix wrong foreign constraint names in sqlite

every foreign constraint but the first of each table had a wrong name
generated. the name was generated as parent-table-name + constraint-id
instead of table-name + constraint-id (as done for the first foreign
constraint of every table). this led to duplicated names in the
generated go code.
1 files changed, 1 insertions(+), 1 deletions(-)

M sqlite/sqlite.go
M sqlite/sqlite.go => sqlite/sqlite.go +1 -1
@@ 245,7 245,7 @@ func (d *DB) Foreign(table string) ([]schema.Foreign, error) {
			f.Referenced = referenced
			fs = append(fs, f)
			f = schema.Foreign{
				Name:          fmt.Sprintf("%s%v", parentTable, id),
				Name:          fmt.Sprintf("%s%v", table, id),
				Child:         schema.NewTable(table, table),
				Parent:        schema.NewTable(parentTable, parentTable),
				ChildColumns:  childCs,