Skip to content

Commit

Permalink
Fix schema overwrite.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 18, 2024
1 parent a9cdb75 commit 299cdc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/Model/Behavior/JsonableBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public function initialize(array $config): void {
throw new RuntimeException('Fields and Map need to be of the same length if map is specified.');
}
foreach ($this->_config['fields'] as $field) {
$this->_table->getSchema()->setColumnType($field, 'array');
if ($this->_table->getSchema()->getColumnType($field) !== 'json') {
$this->_table->getSchema()->setColumnType($field, 'json');
}
}
if ($this->_config['encodeParams']['options'] === null) {
$options = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_ERROR_INF_OR_NAN | JSON_PARTIAL_OUTPUT_ON_ERROR;
Expand Down
10 changes: 1 addition & 9 deletions src/Model/Table/QueuedJobsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,8 @@ public function initialize(array $config): void {
'WorkerProcesses.workerkey = QueuedJobs.workerkey',
],
]);
}

/**
* @return \Cake\Database\Schema\TableSchemaInterface
*/
public function getSchema(): TableSchemaInterface {
$schema = parent::getSchema();
$schema->setColumnType('data', 'json');

return $schema;
$this->getSchema()->setColumnType('data', 'json');
}

/**
Expand Down

0 comments on commit 299cdc4

Please sign in to comment.