From 9a268276bad3a3fd7b937658d7072196ea2b57d8 Mon Sep 17 00:00:00 2001 From: Yonghwan SO Date: Sat, 24 Sep 2022 17:45:48 +0900 Subject: [PATCH] made 'version' colume as primary key to fix #659 --- schema_migrations.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/schema_migrations.go b/schema_migrations.go index 946a79d4..548b2bd9 100644 --- a/schema_migrations.go +++ b/schema_migrations.go @@ -1,3 +1,4 @@ +//go:build !appengine // +build !appengine package pop @@ -9,7 +10,7 @@ import ( ) func newSchemaMigrations(name string) fizz.Table { - return fizz.Table{ + tab := fizz.Table{ Name: name, Columns: []fizz.Column{ { @@ -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 }