mirror of
https://github.com/danog/AsyncOrm.git
synced 2024-11-26 20:34:55 +01:00
Fixes
This commit is contained in:
parent
21ad5239e1
commit
7085bc4717
@ -104,9 +104,9 @@ class PostgresArray extends SqlArray
|
|||||||
);
|
);
|
||||||
");
|
");
|
||||||
|
|
||||||
$result = $connection->query("DESCRIBE \"bytea_{$config->table}\"");
|
$result = $connection->query("SELECT * FROM information_schema.columns WHERE table_name='bytea_{$config->table}'");
|
||||||
while ($column = $result->fetchRow()) {
|
while ($column = $result->fetchRow()) {
|
||||||
['Field' => $key, 'Type' => $type, 'Null' => $null] = $column;
|
['column_name' => $key, 'data_type' => $type, 'is_nullable' => $null] = $column;
|
||||||
$type = \strtoupper($type);
|
$type = \strtoupper($type);
|
||||||
if (\str_starts_with($type, 'BIGINT')) {
|
if (\str_starts_with($type, 'BIGINT')) {
|
||||||
$type = 'BIGINT';
|
$type = 'BIGINT';
|
||||||
@ -119,8 +119,14 @@ class PostgresArray extends SqlArray
|
|||||||
$connection->query("ALTER TABLE \"bytea_{$config->table}\" DROP \"$key\"");
|
$connection->query("ALTER TABLE \"bytea_{$config->table}\" DROP \"$key\"");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($expected !== $type || $null !== 'NO') {
|
if ($expected !== $type) {
|
||||||
$connection->query("ALTER TABLE \"bytea_{$config->table}\" MODIFY \"$key\" $expected NOT NULL");
|
if ($expected === 'BIGINT') {
|
||||||
|
$expected .= " USING $key::bigint";
|
||||||
|
}
|
||||||
|
$connection->query("ALTER TABLE \"bytea_{$config->table}\" ALTER COLUMN \"$key\" TYPE $expected");
|
||||||
|
}
|
||||||
|
if ($null !== 'NO') {
|
||||||
|
$connection->query("ALTER TABLE \"bytea_{$config->table}\" ALTER COLUMN \"$key\" SET NOT NULL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,10 +62,7 @@ final class OrmTest extends TestCase
|
|||||||
$f = [];
|
$f = [];
|
||||||
foreach (['redis' => 6379, 'mariadb' => 3306, 'postgres' => 5432] as $image => $port) {
|
foreach (['redis' => 6379, 'mariadb' => 3306, 'postgres' => 5432] as $image => $port) {
|
||||||
$f []= async(function () use ($image, $port) {
|
$f []= async(function () use ($image, $port) {
|
||||||
await([
|
self::shellExec("docker rm -f test_$image 2>/dev/null");
|
||||||
async(self::shellExec(...), "docker pull $image"),
|
|
||||||
async(self::shellExec(...), "docker rm -f test_$image 2>/dev/null")
|
|
||||||
]);
|
|
||||||
|
|
||||||
$args = match ($image) {
|
$args = match ($image) {
|
||||||
'postgres' => '-e POSTGRES_HOST_AUTH_METHOD=trust',
|
'postgres' => '-e POSTGRES_HOST_AUTH_METHOD=trust',
|
||||||
|
Loading…
Reference in New Issue
Block a user