Skip to content

Commit

Permalink
Fix migrations for PSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzondervan committed Aug 12, 2024
1 parent db82028 commit 7535d63
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
6 changes: 0 additions & 6 deletions lib/Db/Catalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ public function getJsonFields(): array

public function hydrate(array $object): self
{


if(isset($object['metadata']) === false) {
$object['metadata'] = [];
}

$jsonFields = $this->getJsonFields();

foreach($object as $key => $value) {
Expand Down
12 changes: 6 additions & 6 deletions lib/Migration/Version6Date20240723125106.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
'notnull' => false,
]
);
$table->addColumn(name: 'organization', typeName: TYPES::JSON, options: [
'default' => 'a:0:{}',
$organization = $table->addColumn(name: 'organization', typeName: TYPES::JSON, options: [
'notnull' => false,
]);
$table->addColumn(name: 'data', typeName: TYPES::JSON, options: [
'default' => 'a:0:{}',
$organization->setDefault('{}');
$data = $table->addColumn(name: 'data', typeName: TYPES::JSON, options: [
'notnull' => false,
]);
$table->addColumn(name: 'attachments', typeName: TYPES::JSON, options: [
'default' => 'a:0:{}',
$data->setDefault('{}');
$attachments = $table->addColumn(name: 'attachments', typeName: TYPES::JSON, options: [
'notnull' => false,
]);
$attachments->setDefault('{}');
$table->addColumn(name: 'attachment_count', typeName: TYPES::INTEGER);
$table->addColumn(name: 'schema', typeName: TYPES::STRING);
$table->addColumn(name: 'status', typeName: TYPES::STRING);
Expand Down
4 changes: 2 additions & 2 deletions lib/Migration/Version6Date20240808085441.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
]);
}
if($table->hasColumn(name: 'metadata') === false) {
$table->addColumn(
$metadata = $table->addColumn(
name: 'metadata',
typeName: Types::JSON,
options: [
'notNull' => false,
'default' => 'a:0:{}'
]);
$metadata->setDefault('{}');
}

}
Expand Down

0 comments on commit 7535d63

Please sign in to comment.