From 0220573b0805fc028d5821a3eed82c2cb73986ea Mon Sep 17 00:00:00 2001 From: Alexis Rico Date: Mon, 27 Nov 2023 16:51:59 +0100 Subject: [PATCH] Fix tests Signed-off-by: Alexis Rico --- pkg/migrations/op_add_column_test.go | 54 +++++++++---------- pkg/migrations/op_alter_column_test.go | 12 ++--- pkg/migrations/op_change_type_test.go | 12 ++--- pkg/migrations/op_create_index_test.go | 12 ++--- pkg/migrations/op_create_table_test.go | 36 ++++++------- pkg/migrations/op_drop_column_test.go | 6 +-- pkg/migrations/op_drop_constraint_test.go | 36 ++++++------- pkg/migrations/op_drop_index_test.go | 6 +-- pkg/migrations/op_drop_table_test.go | 6 +-- pkg/migrations/op_rename_column_test.go | 6 +-- pkg/migrations/op_set_check_test.go | 12 ++--- pkg/migrations/op_set_fk_test.go | 24 ++++----- pkg/migrations/op_set_notnull_test.go | 24 ++++----- .../op_set_replica_identity_test.go | 12 ++--- pkg/migrations/op_set_unique_test.go | 12 ++--- pkg/roll/execute_test.go | 6 +-- 16 files changed, 138 insertions(+), 138 deletions(-) diff --git a/pkg/migrations/op_add_column_test.go b/pkg/migrations/op_add_column_test.go index 3761e10c..466325b0 100644 --- a/pkg/migrations/op_add_column_test.go +++ b/pkg/migrations/op_add_column_test.go @@ -24,9 +24,9 @@ func TestAddColumn(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -121,9 +121,9 @@ func TestAddForeignKeyColumn(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -136,9 +136,9 @@ func TestAddForeignKeyColumn(t *testing.T) { Name: "orders", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "quantity", @@ -223,9 +223,9 @@ func TestAddForeignKeyColumn(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -238,9 +238,9 @@ func TestAddForeignKeyColumn(t *testing.T) { Name: "orders", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "quantity", @@ -332,9 +332,9 @@ func TestAddColumnWithUpSql(t *testing.T) { Name: "products", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -419,9 +419,9 @@ func TestAddNotNullColumnWithNoDefault(t *testing.T) { Name: "products", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -485,9 +485,9 @@ func TestAddColumnValidation(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -604,9 +604,9 @@ func TestAddColumnWithCheckConstraint(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", diff --git a/pkg/migrations/op_alter_column_test.go b/pkg/migrations/op_alter_column_test.go index c251b528..74c33fc0 100644 --- a/pkg/migrations/op_alter_column_test.go +++ b/pkg/migrations/op_alter_column_test.go @@ -18,9 +18,9 @@ func TestAlterColumnValidation(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -32,9 +32,9 @@ func TestAlterColumnValidation(t *testing.T) { Name: "posts", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "title", diff --git a/pkg/migrations/op_change_type_test.go b/pkg/migrations/op_change_type_test.go index 5597a718..16df8886 100644 --- a/pkg/migrations/op_change_type_test.go +++ b/pkg/migrations/op_change_type_test.go @@ -24,9 +24,9 @@ func TestChangeColumnType(t *testing.T) { Name: "reviews", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "username", @@ -157,9 +157,9 @@ func TestChangeColumnTypeValidation(t *testing.T) { Name: "reviews", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "username", diff --git a/pkg/migrations/op_create_index_test.go b/pkg/migrations/op_create_index_test.go index f9092fc8..4fefb537 100644 --- a/pkg/migrations/op_create_index_test.go +++ b/pkg/migrations/op_create_index_test.go @@ -22,9 +22,9 @@ func TestCreateIndex(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -73,9 +73,9 @@ func TestCreateIndexOnMultipleColumns(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", diff --git a/pkg/migrations/op_create_table_test.go b/pkg/migrations/op_create_table_test.go index 9a8509a1..ae7dc505 100644 --- a/pkg/migrations/op_create_table_test.go +++ b/pkg/migrations/op_create_table_test.go @@ -25,9 +25,9 @@ func TestCreateTable(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -84,9 +84,9 @@ func TestCreateTable(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -104,9 +104,9 @@ func TestCreateTable(t *testing.T) { Name: "orders", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "user_id", @@ -181,9 +181,9 @@ func TestCreateTable(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -246,9 +246,9 @@ func TestCreateTableValidation(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -266,9 +266,9 @@ func TestCreateTableValidation(t *testing.T) { Name: "orders", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "user_id", diff --git a/pkg/migrations/op_drop_column_test.go b/pkg/migrations/op_drop_column_test.go index 3079de95..59aa9f44 100644 --- a/pkg/migrations/op_drop_column_test.go +++ b/pkg/migrations/op_drop_column_test.go @@ -24,9 +24,9 @@ func TestDropColumnWithDownSQL(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", diff --git a/pkg/migrations/op_drop_constraint_test.go b/pkg/migrations/op_drop_constraint_test.go index 4ba8e9ac..23637a15 100644 --- a/pkg/migrations/op_drop_constraint_test.go +++ b/pkg/migrations/op_drop_constraint_test.go @@ -24,9 +24,9 @@ func TestDropConstraint(t *testing.T) { Name: "posts", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "title", @@ -153,9 +153,9 @@ func TestDropConstraint(t *testing.T) { Name: "posts", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "title", @@ -219,9 +219,9 @@ func TestDropConstraint(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -233,9 +233,9 @@ func TestDropConstraint(t *testing.T) { Name: "posts", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "title", @@ -384,9 +384,9 @@ func TestDropConstraint(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -466,9 +466,9 @@ func TestDropConstraintValidation(t *testing.T) { Name: "posts", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "title", diff --git a/pkg/migrations/op_drop_index_test.go b/pkg/migrations/op_drop_index_test.go index 4fb6c8e3..cd1751a8 100644 --- a/pkg/migrations/op_drop_index_test.go +++ b/pkg/migrations/op_drop_index_test.go @@ -22,9 +22,9 @@ func TestDropIndex(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", diff --git a/pkg/migrations/op_drop_table_test.go b/pkg/migrations/op_drop_table_test.go index e84ac110..9f28ff04 100644 --- a/pkg/migrations/op_drop_table_test.go +++ b/pkg/migrations/op_drop_table_test.go @@ -22,9 +22,9 @@ func TestDropTable(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", diff --git a/pkg/migrations/op_rename_column_test.go b/pkg/migrations/op_rename_column_test.go index 6700d48b..eaac4e44 100644 --- a/pkg/migrations/op_rename_column_test.go +++ b/pkg/migrations/op_rename_column_test.go @@ -23,9 +23,9 @@ func TestRenameColumn(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "username", diff --git a/pkg/migrations/op_set_check_test.go b/pkg/migrations/op_set_check_test.go index b78dd008..7d745f41 100644 --- a/pkg/migrations/op_set_check_test.go +++ b/pkg/migrations/op_set_check_test.go @@ -23,9 +23,9 @@ func TestSetCheckConstraint(t *testing.T) { Name: "posts", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "title", @@ -148,9 +148,9 @@ func TestSetCheckConstraintValidation(t *testing.T) { Name: "posts", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "title", diff --git a/pkg/migrations/op_set_fk_test.go b/pkg/migrations/op_set_fk_test.go index 3397dda7..96cf22eb 100644 --- a/pkg/migrations/op_set_fk_test.go +++ b/pkg/migrations/op_set_fk_test.go @@ -23,9 +23,9 @@ func TestSetForeignKey(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -37,9 +37,9 @@ func TestSetForeignKey(t *testing.T) { Name: "posts", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "title", @@ -183,9 +183,9 @@ func TestSetForeignKeyValidation(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -197,9 +197,9 @@ func TestSetForeignKeyValidation(t *testing.T) { Name: "posts", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "title", diff --git a/pkg/migrations/op_set_notnull_test.go b/pkg/migrations/op_set_notnull_test.go index 48b3f917..c78fceea 100644 --- a/pkg/migrations/op_set_notnull_test.go +++ b/pkg/migrations/op_set_notnull_test.go @@ -24,9 +24,9 @@ func TestSetNotNull(t *testing.T) { Name: "reviews", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "username", @@ -166,9 +166,9 @@ func TestSetNotNull(t *testing.T) { Name: "reviews", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "username", @@ -235,9 +235,9 @@ func TestSetNotNullValidation(t *testing.T) { Name: "reviews", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "username", @@ -288,9 +288,9 @@ func TestSetNotNullValidation(t *testing.T) { Name: "reviews", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "username", diff --git a/pkg/migrations/op_set_replica_identity_test.go b/pkg/migrations/op_set_replica_identity_test.go index a9124b05..b6803806 100644 --- a/pkg/migrations/op_set_replica_identity_test.go +++ b/pkg/migrations/op_set_replica_identity_test.go @@ -19,9 +19,9 @@ func TestSetReplicaIdentity(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", @@ -150,9 +150,9 @@ func TestSetReplicaIdentityValidation(t *testing.T) { Name: "users", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "name", diff --git a/pkg/migrations/op_set_unique_test.go b/pkg/migrations/op_set_unique_test.go index 4b6e3c75..4d483fd3 100644 --- a/pkg/migrations/op_set_unique_test.go +++ b/pkg/migrations/op_set_unique_test.go @@ -24,9 +24,9 @@ func TestSetColumnUnique(t *testing.T) { Name: "reviews", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "username", @@ -125,9 +125,9 @@ func TestSetColumnUnique(t *testing.T) { Name: "reviews", Columns: []migrations.Column{ { - Name: "id", - Type: "serial", - PrimaryKey: true, + Name: "id", + Type: "serial", + Pk: true, }, { Name: "username", diff --git a/pkg/roll/execute_test.go b/pkg/roll/execute_test.go index 57bdbc29..3967d0eb 100644 --- a/pkg/roll/execute_test.go +++ b/pkg/roll/execute_test.go @@ -466,9 +466,9 @@ func createTableOp(tableName string) *migrations.OpCreateTable { Name: tableName, Columns: []migrations.Column{ { - Name: "id", - Type: "integer", - PrimaryKey: true, + Name: "id", + Type: "integer", + Pk: true, }, { Name: "name",