refactor: ensure non-null values in migration table creation (#2434)

- Change the migration table creation to not allow null values for the column

fix https://gitea.com/xorm/xorm/issues/2433

Signed-off-by: appleboy <appleboy.tw@gmail.com>

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2434
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
appleboy 2024-03-17 03:53:16 +00:00 committed by Lunny Xiao
parent 7a535a7899
commit be77a7084b
1 changed files with 1 additions and 1 deletions

View File

@ -199,7 +199,7 @@ func (m *Migrate) createMigrationTableIfNotExists() error {
idCol := schemas.NewColumn(m.options.IDColumnName, "", schemas.SQLType{ idCol := schemas.NewColumn(m.options.IDColumnName, "", schemas.SQLType{
Name: "VARCHAR", Name: "VARCHAR",
}, 255, 0, true) }, 255, 0, false)
idCol.IsPrimaryKey = true idCol.IsPrimaryKey = true
table := schemas.NewTable(m.options.TableName, reflect.TypeOf(new(schemas.Table))) table := schemas.NewTable(m.options.TableName, reflect.TypeOf(new(schemas.Table)))