diff --git a/migrate.go b/migrate.go index 59d6938..e1b73be 100644 --- a/migrate.go +++ b/migrate.go @@ -243,10 +243,12 @@ func createVersionTable(db *sql.DB) error { // create the table and insert an initial value of 0 create := `CREATE TABLE goose_db_version ( + id int unsigned NOT NULL AUTO_INCREMENT, version_id bigint NOT NULL, is_applied boolean NOT NULL, tstamp timestamp NULL default now(), - PRIMARY KEY(tstamp) + PRIMARY KEY(id), + UNIQUE KEY id_tstamp (id, tstamp) );` insert := "INSERT INTO goose_db_version (version_id, is_applied) VALUES (0, true);"