Passed
Push — master ( 01ec74...6d3d6f )
by Blizzz
12:34 queued 10s
created
apps/workflowengine/lib/Migration/Version2000Date20190808074233.php 1 patch
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -14,117 +14,117 @@
 block discarded – undo
14 14
 
15 15
 class Version2000Date20190808074233 extends SimpleMigrationStep {
16 16
 
17
-	/**
18
-	 * @param IOutput $output
19
-	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
20
-	 * @param array $options
21
-	 * @return null|ISchemaWrapper
22
-	 */
23
-	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
24
-		/** @var ISchemaWrapper $schema */
25
-		$schema = $schemaClosure();
17
+    /**
18
+     * @param IOutput $output
19
+     * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
20
+     * @param array $options
21
+     * @return null|ISchemaWrapper
22
+     */
23
+    public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
24
+        /** @var ISchemaWrapper $schema */
25
+        $schema = $schemaClosure();
26 26
 
27
-		if (!$schema->hasTable('flow_checks')) {
28
-			$table = $schema->createTable('flow_checks');
29
-			$table->addColumn('id', Types::INTEGER, [
30
-				'autoincrement' => true,
31
-				'notnull' => true,
32
-				'length' => 4,
33
-			]);
34
-			$table->addColumn('class', Types::STRING, [
35
-				'notnull' => true,
36
-				'length' => 256,
37
-				'default' => '',
38
-			]);
39
-			$table->addColumn('operator', Types::STRING, [
40
-				'notnull' => true,
41
-				'length' => 16,
42
-				'default' => '',
43
-			]);
44
-			$table->addColumn('value', Types::TEXT, [
45
-				'notnull' => false,
46
-			]);
47
-			$table->addColumn('hash', Types::STRING, [
48
-				'notnull' => true,
49
-				'length' => 32,
50
-				'default' => '',
51
-			]);
52
-			$table->setPrimaryKey(['id']);
53
-			$table->addUniqueIndex(['hash'], 'flow_unique_hash');
54
-		}
27
+        if (!$schema->hasTable('flow_checks')) {
28
+            $table = $schema->createTable('flow_checks');
29
+            $table->addColumn('id', Types::INTEGER, [
30
+                'autoincrement' => true,
31
+                'notnull' => true,
32
+                'length' => 4,
33
+            ]);
34
+            $table->addColumn('class', Types::STRING, [
35
+                'notnull' => true,
36
+                'length' => 256,
37
+                'default' => '',
38
+            ]);
39
+            $table->addColumn('operator', Types::STRING, [
40
+                'notnull' => true,
41
+                'length' => 16,
42
+                'default' => '',
43
+            ]);
44
+            $table->addColumn('value', Types::TEXT, [
45
+                'notnull' => false,
46
+            ]);
47
+            $table->addColumn('hash', Types::STRING, [
48
+                'notnull' => true,
49
+                'length' => 32,
50
+                'default' => '',
51
+            ]);
52
+            $table->setPrimaryKey(['id']);
53
+            $table->addUniqueIndex(['hash'], 'flow_unique_hash');
54
+        }
55 55
 
56
-		if (!$schema->hasTable('flow_operations')) {
57
-			$table = $schema->createTable('flow_operations');
58
-			$table->addColumn('id', Types::INTEGER, [
59
-				'autoincrement' => true,
60
-				'notnull' => true,
61
-				'length' => 4,
62
-			]);
63
-			$table->addColumn('class', Types::STRING, [
64
-				'notnull' => true,
65
-				'length' => 256,
66
-				'default' => '',
67
-			]);
68
-			$table->addColumn('name', Types::STRING, [
69
-				'notnull' => true,
70
-				'length' => 256,
71
-				'default' => '',
72
-			]);
73
-			$table->addColumn('checks', Types::TEXT, [
74
-				'notnull' => false,
75
-			]);
76
-			$table->addColumn('operation', Types::TEXT, [
77
-				'notnull' => false,
78
-			]);
79
-			$this->ensureEntityColumns($table);
80
-			$table->setPrimaryKey(['id']);
81
-		} else {
82
-			$table = $schema->getTable('flow_operations');
83
-			$this->ensureEntityColumns($table);
84
-		}
56
+        if (!$schema->hasTable('flow_operations')) {
57
+            $table = $schema->createTable('flow_operations');
58
+            $table->addColumn('id', Types::INTEGER, [
59
+                'autoincrement' => true,
60
+                'notnull' => true,
61
+                'length' => 4,
62
+            ]);
63
+            $table->addColumn('class', Types::STRING, [
64
+                'notnull' => true,
65
+                'length' => 256,
66
+                'default' => '',
67
+            ]);
68
+            $table->addColumn('name', Types::STRING, [
69
+                'notnull' => true,
70
+                'length' => 256,
71
+                'default' => '',
72
+            ]);
73
+            $table->addColumn('checks', Types::TEXT, [
74
+                'notnull' => false,
75
+            ]);
76
+            $table->addColumn('operation', Types::TEXT, [
77
+                'notnull' => false,
78
+            ]);
79
+            $this->ensureEntityColumns($table);
80
+            $table->setPrimaryKey(['id']);
81
+        } else {
82
+            $table = $schema->getTable('flow_operations');
83
+            $this->ensureEntityColumns($table);
84
+        }
85 85
 
86
-		if (!$schema->hasTable('flow_operations_scope')) {
87
-			$table = $schema->createTable('flow_operations_scope');
88
-			$table->addColumn('id', Types::BIGINT, [
89
-				'autoincrement' => true,
90
-				'notnull' => true,
91
-				'length' => 4,
92
-			]);
93
-			$table->addColumn('operation_id', Types::INTEGER, [
94
-				'notnull' => true,
95
-				'length' => 4,
96
-				'default' => 0,
97
-			]);
98
-			$table->addColumn('type', Types::INTEGER, [
99
-				'notnull' => true,
100
-				'length' => 4,
101
-				'default' => 0,
102
-			]);
103
-			$table->addColumn('value', Types::STRING, [
104
-				'notnull' => false,
105
-				'length' => 64,
106
-				'default' => '',
107
-			]);
108
-			$table->setPrimaryKey(['id']);
109
-			$table->addUniqueIndex(['operation_id', 'type', 'value'], 'flow_unique_scope');
110
-		}
86
+        if (!$schema->hasTable('flow_operations_scope')) {
87
+            $table = $schema->createTable('flow_operations_scope');
88
+            $table->addColumn('id', Types::BIGINT, [
89
+                'autoincrement' => true,
90
+                'notnull' => true,
91
+                'length' => 4,
92
+            ]);
93
+            $table->addColumn('operation_id', Types::INTEGER, [
94
+                'notnull' => true,
95
+                'length' => 4,
96
+                'default' => 0,
97
+            ]);
98
+            $table->addColumn('type', Types::INTEGER, [
99
+                'notnull' => true,
100
+                'length' => 4,
101
+                'default' => 0,
102
+            ]);
103
+            $table->addColumn('value', Types::STRING, [
104
+                'notnull' => false,
105
+                'length' => 64,
106
+                'default' => '',
107
+            ]);
108
+            $table->setPrimaryKey(['id']);
109
+            $table->addUniqueIndex(['operation_id', 'type', 'value'], 'flow_unique_scope');
110
+        }
111 111
 
112
-		return $schema;
113
-	}
112
+        return $schema;
113
+    }
114 114
 
115
-	protected function ensureEntityColumns(Table $table) {
116
-		if (!$table->hasColumn('entity')) {
117
-			$table->addColumn('entity', Types::STRING, [
118
-				'notnull' => true,
119
-				'length' => 256,
120
-				'default' => File::class,
121
-			]);
122
-		}
123
-		if (!$table->hasColumn('events')) {
124
-			$table->addColumn('events', Types::TEXT, [
125
-				'notnull' => true,
126
-				'default' => '[]',
127
-			]);
128
-		}
129
-	}
115
+    protected function ensureEntityColumns(Table $table) {
116
+        if (!$table->hasColumn('entity')) {
117
+            $table->addColumn('entity', Types::STRING, [
118
+                'notnull' => true,
119
+                'length' => 256,
120
+                'default' => File::class,
121
+            ]);
122
+        }
123
+        if (!$table->hasColumn('events')) {
124
+            $table->addColumn('events', Types::TEXT, [
125
+                'notnull' => true,
126
+                'default' => '[]',
127
+            ]);
128
+        }
129
+    }
130 130
 }
Please login to merge, or discard this patch.
apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -33,44 +33,44 @@
 block discarded – undo
33 33
 
34 34
 class PopulateNewlyIntroducedDatabaseFields implements IRepairStep {
35 35
 
36
-	/** @var IDBConnection */
37
-	private $dbc;
36
+    /** @var IDBConnection */
37
+    private $dbc;
38 38
 
39
-	public function __construct(IDBConnection $dbc) {
40
-		$this->dbc = $dbc;
41
-	}
39
+    public function __construct(IDBConnection $dbc) {
40
+        $this->dbc = $dbc;
41
+    }
42 42
 
43
-	public function getName() {
44
-		return 'Populating added database structures for workflows';
45
-	}
43
+    public function getName() {
44
+        return 'Populating added database structures for workflows';
45
+    }
46 46
 
47
-	public function run(IOutput $output) {
48
-		$result = $this->getIdsWithoutScope();
47
+    public function run(IOutput $output) {
48
+        $result = $this->getIdsWithoutScope();
49 49
 
50
-		$this->populateScopeTable($result);
50
+        $this->populateScopeTable($result);
51 51
 
52
-		$result->closeCursor();
53
-	}
52
+        $result->closeCursor();
53
+    }
54 54
 
55
-	protected function populateScopeTable(Statement $ids): void {
56
-		$qb = $this->dbc->getQueryBuilder();
55
+    protected function populateScopeTable(Statement $ids): void {
56
+        $qb = $this->dbc->getQueryBuilder();
57 57
 
58
-		$insertQuery = $qb->insert('flow_operations_scope');
59
-		while ($id = $ids->fetchColumn(0)) {
60
-			$insertQuery->values(['operation_id' => $qb->createNamedParameter($id), 'type' => IManager::SCOPE_ADMIN]);
61
-			$insertQuery->execute();
62
-		}
63
-	}
58
+        $insertQuery = $qb->insert('flow_operations_scope');
59
+        while ($id = $ids->fetchColumn(0)) {
60
+            $insertQuery->values(['operation_id' => $qb->createNamedParameter($id), 'type' => IManager::SCOPE_ADMIN]);
61
+            $insertQuery->execute();
62
+        }
63
+    }
64 64
 
65
-	protected function getIdsWithoutScope(): Statement {
66
-		$qb = $this->dbc->getQueryBuilder();
67
-		$selectQuery = $qb->select('o.id')
68
-			->from('flow_operations', 'o')
69
-			->leftJoin('o', 'flow_operations_scope', 's', $qb->expr()->eq('o.id', 's.operation_id'))
70
-			->where($qb->expr()->isNull('s.operation_id'));
71
-		// The left join operation is not necessary, usually, but it's a safe-guard
72
-		// in case the repair step is executed multiple times for whatever reason.
65
+    protected function getIdsWithoutScope(): Statement {
66
+        $qb = $this->dbc->getQueryBuilder();
67
+        $selectQuery = $qb->select('o.id')
68
+            ->from('flow_operations', 'o')
69
+            ->leftJoin('o', 'flow_operations_scope', 's', $qb->expr()->eq('o.id', 's.operation_id'))
70
+            ->where($qb->expr()->isNull('s.operation_id'));
71
+        // The left join operation is not necessary, usually, but it's a safe-guard
72
+        // in case the repair step is executed multiple times for whatever reason.
73 73
 
74
-		return $selectQuery->execute();
75
-	}
74
+        return $selectQuery->execute();
75
+    }
76 76
 }
Please login to merge, or discard this patch.