Skip to content

Commit

Permalink
Fix issue where unwrapped migration code was being validated (and fai…
Browse files Browse the repository at this point in the history
…led) after DB operations
  • Loading branch information
bennothommo committed Sep 9, 2024
1 parent ac6afd6 commit 80f3889
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions behaviors/IndexDatabaseTableOperations.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ public function onDatabaseTableMigrationApply()
$model = new MigrationModel();
$model->setPluginCodeObj($pluginCode);

$model->fill($_POST);
$model->fill([
'version' => Request::input('version'),
'description' => Request::input('description'),
]);

$operation = Input::get('operation');
$table = Input::get('table');
Expand All @@ -91,12 +94,11 @@ public function onDatabaseTableMigrationApply()
$model->makeScriptFileNameUnique();

$codeGenerator = new TableMigrationCodeGenerator();
$model->code = $codeGenerator->wrapMigrationCode($model->scriptFileName, $model->code, $pluginCode);
$model->code = $codeGenerator->wrapMigrationCode($model->scriptFileName, Request::input('code'), $pluginCode);

try {
$model->save();
}
catch (Exception $ex) {
} catch (Exception $ex) {
throw new ApplicationException($ex->getMessage());
}

Expand Down
2 changes: 1 addition & 1 deletion classes/TableMigrationCodeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function createOrUpdateTable($updatedTable, $existingTable, $newTableName
* @param string $scriptFilename Specifies the migration script file name
* @param string $code Specifies the migration code
* @param PluginCode $pluginCodeObj The plugin code object
* @return TextParser
* @return string
*/
public function wrapMigrationCode($scriptFilename, $code, $pluginCodeObj)
{
Expand Down

0 comments on commit 80f3889

Please sign in to comment.