Closed ivan-garcia-santamaria closed 3 years ago
Can you use the current_schema value from this one? https://github.com/go-gorm/postgres/blob/fe12bf34e00e7dc0557bdfe73993b82a71c5a7cf/migrator.go#L323
But the wrong sentence is this:
SELECT ordinal_position
FROM information_schema.columns
WHERE table_name = 'my-table' AND column_name = 'created_at'
And It already has its schema. You can't use CurrentSchema because you can't set any schema
What did this pull request do?
Fix migrator.go with multiple schemas with same dataset
User Case Description
If you have a database with multiple schemas with the same tables, when you run migrator, it executes this query:
and it is wrong because the first subquery return a multiple choice and query fails with this error:
For example, with this database:
The migrator fails because there are multiple schemas with the same credentials table.
The correct query is this, including table_schema=CURRENT_SCHEMA():