Skip to content

Missing keyword 'column' in the 'alter table' clause for Migrator().DropColumn() #80

@shelly-li-sl

Description

@shelly-li-sl

In migrator.go, the returned sql for DropColumn() is missing the keyword 'column'.

===Returned sql in DropColumn()

 return m.DB.Exec(
			"ALTER TABLE ? DROP ?",   
			clause.Table{Name: stmt.Schema.Table},
			clause.Column{Name: name},
		).Error

===For the following test:
DB.Table("migrate_add_drop_columns").Migrator().DropColumn(&MigrateAddDropColumns{}, "NewName")
===Current generated SQL:
ALTER TABLE "migrate_add_drop_columns" DROP "new_name"
===Expected SQL:
ALTER TABLE "migrate_add_drop_columns" DROP COLUMN "new_name"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions