Open hhindriks opened 6 months ago
Migrator().DropTable( &item{}) is not working properly when implementing item.TableName() and returning a name containing a schema, e.g:
Migrator().DropTable( &item{})
item.TableName()
type item struct { Name string } func (i *item)TableName() string {return "test.item"} // specify schema name as "test"
calling db.Migrator().DropTable(&item{}) generates the following SQL statement:
db.Migrator().DropTable(&item{})
DROP TABLE IF EXISTS "item"
the statement is not using the full table name, the "schema." part is missing.
What is the proper way to find the table name for a struct? - I have seen different methods throughout issues and code.
Migrator().DropTable( &item{})
is not working properly when implementingitem.TableName()
and returning a name containing a schema, e.g:calling
db.Migrator().DropTable(&item{})
generates the following SQL statement:the statement is not using the full table name, the "schema." part is missing.
What is the proper way to find the table name for a struct? - I have seen different methods throughout issues and code.