Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Migrator().DropTable() ignoring schema from struct.TableName() #127

Open
hhindriks opened this issue Mar 1, 2024 · 0 comments
Open

Migrator().DropTable() ignoring schema from struct.TableName() #127

hhindriks opened this issue Mar 1, 2024 · 0 comments
Assignees

Comments

@hhindriks
Copy link

Migrator().DropTable( &item{}) is not working properly when implementing item.TableName() and returning a name containing a schema, e.g:

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:

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants