Hi, I have existing mySQL database with id column named “test_id” (primary key) .
If I define table like this:
func GetTestTable(ctx *context.Context) table.Table {
test := table.NewDefaultTable(table.DefaultConfigWithDriver("mysql"))
info := test.GetInfo().HideFilterArea()
info.AddField("Test_id", "test_id", db.Int)
info.AddField("Test_name", "test_name", db.Varchar)
info.AddField("Test_description", "test_description", db.Text)
info.SetTable("test").SetTitle("Test").SetDescription("Test")
formList := test.GetForm()
formList.AddField("Test_id", "test_id", db.Int, form.Number)
formList.AddField("Test_name", "test_name", db.Varchar, form.Text)
formList.AddField("Test_description", "test_description", db.Text, form.Text)
formList.SetTable("test").SetTitle("Test").SetDescription("Test")
return test
}
I am getting error:
Error 1054: Unknown column ‘test.id’ in ‘field list’
How can I fix it? Is there a way that id field can be named differently and not “id” ?
Thanks!