Skip to content

Commit eccde74

Browse files
authored
Remove PostgresAdapter::getDefaultValueDefinition method override (#2118)
1 parent 81fd976 commit eccde74

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

src/Phinx/Db/Adapter/PostgresAdapter.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,26 +1206,6 @@ public function dropDatabase($name): void
12061206
$this->connect();
12071207
}
12081208

1209-
/**
1210-
* Get the defintion for a `DEFAULT` statement.
1211-
*
1212-
* @param mixed $default default value
1213-
* @param string|null $columnType column type added
1214-
* @return string
1215-
*/
1216-
protected function getDefaultValueDefinition($default, ?string $columnType = null): string
1217-
{
1218-
if (is_string($default) && $default !== 'CURRENT_TIMESTAMP') {
1219-
$default = $this->getConnection()->quote($default);
1220-
} elseif (is_bool($default)) {
1221-
$default = $this->castToBool($default);
1222-
} elseif ($columnType === static::PHINX_TYPE_BOOLEAN) {
1223-
$default = $this->castToBool((bool)$default);
1224-
}
1225-
1226-
return isset($default) ? 'DEFAULT ' . $default : '';
1227-
}
1228-
12291209
/**
12301210
* Gets the PostgreSQL Column Definition for a Column object.
12311211
*

tests/Phinx/Db/Adapter/PostgresAdapterTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,11 +2182,11 @@ public function testDumpCreateTable()
21822182

21832183
if ($this->usingPostgres10()) {
21842184
$expectedOutput = 'CREATE TABLE "public"."table1" ("id" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY, "column1" CHARACTER VARYING (255) ' .
2185-
'NULL, "column2" INTEGER NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
2185+
'NULL, "column2" INTEGER NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
21862186
'"table1_pkey" PRIMARY KEY ("id"));';
21872187
} else {
21882188
$expectedOutput = 'CREATE TABLE "public"."table1" ("id" SERIAL NOT NULL, "column1" CHARACTER VARYING (255) ' .
2189-
'NULL, "column2" INTEGER NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
2189+
'NULL, "column2" INTEGER NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
21902190
'"table1_pkey" PRIMARY KEY ("id"));';
21912191
}
21922192
$actualOutput = $consoleOutput->fetch();
@@ -2214,11 +2214,11 @@ public function testDumpCreateTableWithSchema()
22142214

22152215
if ($this->usingPostgres10()) {
22162216
$expectedOutput = 'CREATE TABLE "schema1"."table1" ("id" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY, "column1" CHARACTER VARYING (255) ' .
2217-
'NULL, "column2" INTEGER NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
2217+
'NULL, "column2" INTEGER NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
22182218
'"table1_pkey" PRIMARY KEY ("id"));';
22192219
} else {
22202220
$expectedOutput = 'CREATE TABLE "schema1"."table1" ("id" SERIAL NOT NULL, "column1" CHARACTER VARYING (255) ' .
2221-
'NULL, "column2" INTEGER NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
2221+
'NULL, "column2" INTEGER NULL, "column3" CHARACTER VARYING (255) NOT NULL DEFAULT \'test\', CONSTRAINT ' .
22222222
'"table1_pkey" PRIMARY KEY ("id"));';
22232223
}
22242224
$actualOutput = $consoleOutput->fetch();

0 commit comments

Comments
 (0)