Skip to content

Commit

Permalink
made 'version' colume as primary key to fix #659
Browse files Browse the repository at this point in the history
  • Loading branch information
sio4 committed Sep 24, 2022
1 parent df9e1b2 commit 9a26827
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion schema_migrations.go
@@ -1,3 +1,4 @@
//go:build !appengine
// +build !appengine

package pop
Expand All @@ -9,7 +10,7 @@ import (
)

func newSchemaMigrations(name string) fizz.Table {
return fizz.Table{
tab := fizz.Table{
Name: name,
Columns: []fizz.Column{
{
Expand All @@ -24,4 +25,9 @@ func newSchemaMigrations(name string) fizz.Table {
{Name: fmt.Sprintf("%s_version_idx", name), Columns: []string{"version"}, Unique: true},
},
}
// this is for https://github.com/gobuffalo/pop/issues/659.
// primary key is not necessary for the migration table but it looks like
// some database engine versions requires it for index.
tab.PrimaryKey("version")
return tab
}

0 comments on commit 9a26827

Please sign in to comment.