Fix "Cannot add a NOT NULL column with default value NULL"

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2019-09-24 11:01:18 +02:00 committed by Roeland Jago Douma
parent cc6874df19
commit 2959e15c7a
No known key found for this signature in database
GPG Key ID: F941078878347C0C
3 changed files with 12 additions and 3 deletions

View File

@ -27,7 +27,7 @@ return array(
'OCA\\WorkflowEngine\\Helper\\ScopeContext' => $baseDir . '/../lib/Helper/ScopeContext.php', 'OCA\\WorkflowEngine\\Helper\\ScopeContext' => $baseDir . '/../lib/Helper/ScopeContext.php',
'OCA\\WorkflowEngine\\Manager' => $baseDir . '/../lib/Manager.php', 'OCA\\WorkflowEngine\\Manager' => $baseDir . '/../lib/Manager.php',
'OCA\\WorkflowEngine\\Migration\\PopulateNewlyIntroducedDatabaseFields' => $baseDir . '/../lib/Migration/PopulateNewlyIntroducedDatabaseFields.php', 'OCA\\WorkflowEngine\\Migration\\PopulateNewlyIntroducedDatabaseFields' => $baseDir . '/../lib/Migration/PopulateNewlyIntroducedDatabaseFields.php',
'OCA\\WorkflowEngine\\Migration\\Version2019Date20190808074233' => $baseDir . '/../lib/Migration/Version2019Date20190808074233.php', 'OCA\\WorkflowEngine\\Migration\\Version2000Date20190808074233' => $baseDir . '/../lib/Migration/Version2000Date20190808074233.php',
'OCA\\WorkflowEngine\\Service\\RuleMatcher' => $baseDir . '/../lib/Service/RuleMatcher.php', 'OCA\\WorkflowEngine\\Service\\RuleMatcher' => $baseDir . '/../lib/Service/RuleMatcher.php',
'OCA\\WorkflowEngine\\Settings\\ASettings' => $baseDir . '/../lib/Settings/ASettings.php', 'OCA\\WorkflowEngine\\Settings\\ASettings' => $baseDir . '/../lib/Settings/ASettings.php',
'OCA\\WorkflowEngine\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php', 'OCA\\WorkflowEngine\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php',

View File

@ -42,7 +42,7 @@ class ComposerStaticInitWorkflowEngine
'OCA\\WorkflowEngine\\Helper\\ScopeContext' => __DIR__ . '/..' . '/../lib/Helper/ScopeContext.php', 'OCA\\WorkflowEngine\\Helper\\ScopeContext' => __DIR__ . '/..' . '/../lib/Helper/ScopeContext.php',
'OCA\\WorkflowEngine\\Manager' => __DIR__ . '/..' . '/../lib/Manager.php', 'OCA\\WorkflowEngine\\Manager' => __DIR__ . '/..' . '/../lib/Manager.php',
'OCA\\WorkflowEngine\\Migration\\PopulateNewlyIntroducedDatabaseFields' => __DIR__ . '/..' . '/../lib/Migration/PopulateNewlyIntroducedDatabaseFields.php', 'OCA\\WorkflowEngine\\Migration\\PopulateNewlyIntroducedDatabaseFields' => __DIR__ . '/..' . '/../lib/Migration/PopulateNewlyIntroducedDatabaseFields.php',
'OCA\\WorkflowEngine\\Migration\\Version2019Date20190808074233' => __DIR__ . '/..' . '/../lib/Migration/Version2019Date20190808074233.php', 'OCA\\WorkflowEngine\\Migration\\Version2000Date20190808074233' => __DIR__ . '/..' . '/../lib/Migration/Version2000Date20190808074233.php',
'OCA\\WorkflowEngine\\Service\\RuleMatcher' => __DIR__ . '/..' . '/../lib/Service/RuleMatcher.php', 'OCA\\WorkflowEngine\\Service\\RuleMatcher' => __DIR__ . '/..' . '/../lib/Service/RuleMatcher.php',
'OCA\\WorkflowEngine\\Settings\\ASettings' => __DIR__ . '/..' . '/../lib/Settings/ASettings.php', 'OCA\\WorkflowEngine\\Settings\\ASettings' => __DIR__ . '/..' . '/../lib/Settings/ASettings.php',
'OCA\\WorkflowEngine\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php', 'OCA\\WorkflowEngine\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php',

View File

@ -11,7 +11,7 @@ use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep; use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput; use OCP\Migration\IOutput;
class Version2019Date20190808074233 extends SimpleMigrationStep { class Version2000Date20190808074233 extends SimpleMigrationStep {
/** /**
* @param IOutput $output * @param IOutput $output
@ -33,10 +33,12 @@ class Version2019Date20190808074233 extends SimpleMigrationStep {
$table->addColumn('class', Type::STRING, [ $table->addColumn('class', Type::STRING, [
'notnull' => true, 'notnull' => true,
'length' => 256, 'length' => 256,
'default' => '',
]); ]);
$table->addColumn('operator', Type::STRING, [ $table->addColumn('operator', Type::STRING, [
'notnull' => true, 'notnull' => true,
'length' => 16, 'length' => 16,
'default' => '',
]); ]);
$table->addColumn('value', Type::TEXT, [ $table->addColumn('value', Type::TEXT, [
'notnull' => false, 'notnull' => false,
@ -44,6 +46,7 @@ class Version2019Date20190808074233 extends SimpleMigrationStep {
$table->addColumn('hash', Type::STRING, [ $table->addColumn('hash', Type::STRING, [
'notnull' => true, 'notnull' => true,
'length' => 32, 'length' => 32,
'default' => '',
]); ]);
$table->setPrimaryKey(['id']); $table->setPrimaryKey(['id']);
$table->addUniqueIndex(['hash'], 'flow_unique_hash'); $table->addUniqueIndex(['hash'], 'flow_unique_hash');
@ -59,10 +62,12 @@ class Version2019Date20190808074233 extends SimpleMigrationStep {
$table->addColumn('class', Type::STRING, [ $table->addColumn('class', Type::STRING, [
'notnull' => true, 'notnull' => true,
'length' => 256, 'length' => 256,
'default' => '',
]); ]);
$table->addColumn('name', Type::STRING, [ $table->addColumn('name', Type::STRING, [
'notnull' => true, 'notnull' => true,
'length' => 256, 'length' => 256,
'default' => '',
]); ]);
$table->addColumn('checks', Type::TEXT, [ $table->addColumn('checks', Type::TEXT, [
'notnull' => false, 'notnull' => false,
@ -87,14 +92,17 @@ class Version2019Date20190808074233 extends SimpleMigrationStep {
$table->addColumn('operation_id', Type::INTEGER, [ $table->addColumn('operation_id', Type::INTEGER, [
'notnull' => true, 'notnull' => true,
'length' => 4, 'length' => 4,
'default' => 0,
]); ]);
$table->addColumn('type', Type::INTEGER, [ $table->addColumn('type', Type::INTEGER, [
'notnull' => true, 'notnull' => true,
'length' => 4, 'length' => 4,
'default' => 0,
]); ]);
$table->addColumn('value', Type::STRING, [ $table->addColumn('value', Type::STRING, [
'notnull' => false, 'notnull' => false,
'length' => 64, 'length' => 64,
'default' => '',
]); ]);
$table->setPrimaryKey(['id']); $table->setPrimaryKey(['id']);
$table->addUniqueIndex(['operation_id', 'type', 'value'], 'flow_unique_scope'); $table->addUniqueIndex(['operation_id', 'type', 'value'], 'flow_unique_scope');
@ -108,6 +116,7 @@ class Version2019Date20190808074233 extends SimpleMigrationStep {
$table->addColumn('entity', Type::STRING, [ $table->addColumn('entity', Type::STRING, [
'notnull' => true, 'notnull' => true,
'length' => 256, 'length' => 256,
'default' => '',
]); ]);
} }
if(!$table->hasColumn('events')) { if(!$table->hasColumn('events')) {