From 186d3c45d4d7e3274a8f0e4a1b5a58a40312ee9c Mon Sep 17 00:00:00 2001 From: He Zhangjian Date: Sat, 4 Jan 2025 15:16:52 +0800 Subject: [PATCH] fix: add primary key to schema history table definition Signed-off-by: He Zhangjian --- database_postgres.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/database_postgres.go b/database_postgres.go index 71d41ab..65e8354 100644 --- a/database_postgres.go +++ b/database_postgres.go @@ -20,7 +20,7 @@ type PostgresDatabase struct { func (p *PostgresDatabase) CreateSchemaHistoryTable() (sql.Result, error) { return p.db.Exec(`CREATE TABLE IF NOT EXISTS flyway_schema_history ( - installed_rank INT NOT NULL, + installed_rank INT NOT NULL PRIMARY KEY, version VARCHAR(50) DEFAULT NULL, description VARCHAR(200) NOT NULL, type VARCHAR(20) NOT NULL, @@ -31,7 +31,6 @@ func (p *PostgresDatabase) CreateSchemaHistoryTable() (sql.Result, error) { execution_time INTEGER NOT NULL, success BOOLEAN NOT NULL ); - ALTER TABLE flyway_schema_history ADD CONSTRAINT flyway_schema_history_pk PRIMARY KEY (installed_rank); `) }