@@ -229,20 +229,20 @@ discard block |
||
| 229 | 229 | if (in_array($column, $auditColumns)) |
| 230 | 230 | { |
| 231 | 231 | $this->rows[] = ['name' => $column, |
| 232 | - 'audit' => $this->auditTable->getColumns()->getColumn($column), |
|
| 233 | - 'data' => $this->dataTable->getColumns()->getColumn($column), |
|
| 234 | - 'type' => 'column', |
|
| 235 | - 'new' => false, |
|
| 236 | - 'obsolete' => false]; |
|
| 232 | + 'audit' => $this->auditTable->getColumns()->getColumn($column), |
|
| 233 | + 'data' => $this->dataTable->getColumns()->getColumn($column), |
|
| 234 | + 'type' => 'column', |
|
| 235 | + 'new' => false, |
|
| 236 | + 'obsolete' => false]; |
|
| 237 | 237 | } |
| 238 | 238 | else |
| 239 | 239 | { |
| 240 | 240 | $this->rows[] = ['name' => $column, |
| 241 | - 'audit' => null, |
|
| 242 | - 'data' => $this->dataTable->getColumns()->getColumn($column), |
|
| 243 | - 'type' => 'column', |
|
| 244 | - 'new' => true, |
|
| 245 | - 'obsolete' => false]; |
|
| 241 | + 'audit' => null, |
|
| 242 | + 'data' => $this->dataTable->getColumns()->getColumn($column), |
|
| 243 | + 'type' => 'column', |
|
| 244 | + 'new' => true, |
|
| 245 | + 'obsolete' => false]; |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
@@ -251,11 +251,11 @@ discard block |
||
| 251 | 251 | if (!in_array($column, $dataColumns)) |
| 252 | 252 | { |
| 253 | 253 | $this->rows[] = ['name' => $column, |
| 254 | - 'audit' => $this->auditTable->getColumns()->getColumn($column), |
|
| 255 | - 'data' => null, |
|
| 256 | - 'type' => 'column', |
|
| 257 | - 'new' => false, |
|
| 258 | - 'obsolete' => true]; |
|
| 254 | + 'audit' => $this->auditTable->getColumns()->getColumn($column), |
|
| 255 | + 'data' => null, |
|
| 256 | + 'type' => 'column', |
|
| 257 | + 'new' => false, |
|
| 258 | + 'obsolete' => true]; |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | foreach ($dataOptions as $option) |
| 273 | 273 | { |
| 274 | 274 | $this->rows[] = ['name' => $option, |
| 275 | - 'audit1' => $this->auditTable->getProperty($option), |
|
| 276 | - 'data1' => $this->dataTable->getProperty($option), |
|
| 277 | - 'type' => 'option', |
|
| 278 | - 'rowspan' => 1]; |
|
| 275 | + 'audit1' => $this->auditTable->getProperty($option), |
|
| 276 | + 'data1' => $this->dataTable->getProperty($option), |
|
| 277 | + 'type' => 'option', |
|
| 278 | + 'rowspan' => 1]; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | foreach ($auditOptions as $option) |
@@ -283,10 +283,10 @@ discard block |
||
| 283 | 283 | if (!in_array($option, $dataOptions)) |
| 284 | 284 | { |
| 285 | 285 | $this->rows[] = ['name' => $option, |
| 286 | - 'audit1' => $this->auditTable->getProperty($option), |
|
| 287 | - 'data2' => null, |
|
| 288 | - 'type' => 'option', |
|
| 289 | - 'rowspan' => 1]; |
|
| 286 | + 'audit1' => $this->auditTable->getProperty($option), |
|
| 287 | + 'data2' => null, |
|
| 288 | + 'type' => 'option', |
|
| 289 | + 'rowspan' => 1]; |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | } |
@@ -32,9 +32,9 @@ |
||
| 32 | 32 | protected function configure() |
| 33 | 33 | { |
| 34 | 34 | $this->setName('diff') |
| 35 | - ->setDescription('Compares data tables and audit tables') |
|
| 36 | - ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file') |
|
| 37 | - ->addOption('full', 'f', InputOption::VALUE_NONE, 'Show all columns'); |
|
| 35 | + ->setDescription('Compares data tables and audit tables') |
|
| 36 | + ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file') |
|
| 37 | + ->addOption('full', 'f', InputOption::VALUE_NONE, 'Show all columns'); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | protected function configure() |
| 32 | 32 | { |
| 33 | 33 | $this->setName('alter-audit-table') |
| 34 | - ->setDescription('Creates alter SQL statements for audit tables') |
|
| 35 | - ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file') |
|
| 36 | - ->addArgument('sql file', InputArgument::OPTIONAL, 'The destination file for the SQL statements'); |
|
| 34 | + ->setDescription('Creates alter SQL statements for audit tables') |
|
| 35 | + ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file') |
|
| 36 | + ->addArgument('sql file', InputArgument::OPTIONAL, 'The destination file for the SQL statements'); |
|
| 37 | 37 | |
| 38 | 38 | $this->setHelp(<<<EOL |
| 39 | 39 | Generates alter table SQL statements for aligning the audit tables with the |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | No SQL statements will be generated for missing or obsolete columns in the |
| 50 | 50 | audit tables. Use the command 'audit' for creating missing columns in audit |
| 51 | 51 | tables. |
| 52 | -EOL |
|
| 52 | +eol |
|
| 53 | 53 | ); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -22,12 +22,12 @@ |
||
| 22 | 22 | protected function configure() |
| 23 | 23 | { |
| 24 | 24 | $this->setName('audit') |
| 25 | - ->setDescription('Maintains audit tables and audit triggers') |
|
| 26 | - ->setHelp("Maintains audit tables and audit triggers:\n". |
|
| 27 | - "- creates new audit tables\n". |
|
| 28 | - "- adds new columns to exiting audit tables\n". |
|
| 29 | - "- creates new and recreates existing audit triggers\n") |
|
| 30 | - ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file'); |
|
| 25 | + ->setDescription('Maintains audit tables and audit triggers') |
|
| 26 | + ->setHelp("Maintains audit tables and audit triggers:\n". |
|
| 27 | + "- creates new audit tables\n". |
|
| 28 | + "- adds new columns to exiting audit tables\n". |
|
| 29 | + "- creates new and recreates existing audit triggers\n") |
|
| 30 | + ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | $tableColumns, |
| 91 | 91 | $skipVariable, |
| 92 | 92 | $additionSql); |
| 93 | - $sql = $helper->buildStatement(); |
|
| 93 | + $sql = $helper->buildStatement(); |
|
| 94 | 94 | |
| 95 | 95 | static::executeNone($sql); |
| 96 | 96 | } |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | array $additionSql): void |
| 89 | 89 | { |
| 90 | 90 | $helper = new CreateAuditTrigger($dataSchemaName, |
| 91 | - $auditSchemaName, |
|
| 92 | - $tableName, |
|
| 93 | - $triggerName, |
|
| 94 | - $triggerAction, |
|
| 95 | - $additionalAuditColumns, |
|
| 96 | - $tableColumns, |
|
| 97 | - $skipVariable, |
|
| 98 | - $additionSql); |
|
| 91 | + $auditSchemaName, |
|
| 92 | + $tableName, |
|
| 93 | + $triggerName, |
|
| 94 | + $triggerAction, |
|
| 95 | + $additionalAuditColumns, |
|
| 96 | + $tableColumns, |
|
| 97 | + $skipVariable, |
|
| 98 | + $additionSql); |
|
| 99 | 99 | $sql = $helper->buildStatement(); |
| 100 | 100 | |
| 101 | 101 | static::executeNone($sql); |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | where TABLE_SCHEMA = %s |
| 278 | 278 | and TABLE_NAME = %s |
| 279 | 279 | order by ORDINAL_POSITION", |
| 280 | - static::quoteString($schemaName), |
|
| 281 | - static::quoteString($tableName)); |
|
| 280 | + static::quoteString($schemaName), |
|
| 281 | + static::quoteString($tableName)); |
|
| 282 | 282 | |
| 283 | 283 | return static::executeRows($sql); |
| 284 | 284 | } |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | inner join information_schema.COLLATION_CHARACTER_SET_APPLICABILITY t2 on t2.COLLATION_NAME = t1.TABLE_COLLATION |
| 305 | 305 | where t1.TABLE_SCHEMA = %s |
| 306 | 306 | and t1.TABLE_NAME = %s', |
| 307 | - static::quoteString($schemaName), |
|
| 308 | - static::quoteString($tableName)); |
|
| 307 | + static::quoteString($schemaName), |
|
| 308 | + static::quoteString($tableName)); |
|
| 309 | 309 | |
| 310 | 310 | return static::executeRow1($sql); |
| 311 | 311 | } |
@@ -327,8 +327,8 @@ discard block |
||
| 327 | 327 | where TRIGGER_SCHEMA = %s |
| 328 | 328 | and EVENT_OBJECT_TABLE = %s |
| 329 | 329 | order by Trigger_Name', |
| 330 | - static::quoteString($schemaName), |
|
| 331 | - static::quoteString($tableName)); |
|
| 330 | + static::quoteString($schemaName), |
|
| 331 | + static::quoteString($tableName)); |
|
| 332 | 332 | |
| 333 | 333 | return static::executeRows($sql); |
| 334 | 334 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | where TRIGGER_SCHEMA = %s |
| 371 | 371 | order by EVENT_OBJECT_TABLE |
| 372 | 372 | , TRIGGER_NAME', |
| 373 | - static::quoteString($schemaName)); |
|
| 373 | + static::quoteString($schemaName)); |
|
| 374 | 374 | |
| 375 | 375 | return static::executeRows($sql); |
| 376 | 376 | } |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | * @return TableColumnsMetadata |
| 81 | 81 | */ |
| 82 | 82 | public static function notInOtherSet(TableColumnsMetadata $columns1, |
| 83 | - TableColumnsMetadata $columns2): TableColumnsMetadata |
|
| 83 | + TableColumnsMetadata $columns2): TableColumnsMetadata |
|
| 84 | 84 | { |
| 85 | 85 | $diff = new TableColumnsMetadata(); |
| 86 | 86 | foreach ($columns1->columns as $column_name => $column1) |
@@ -151,7 +151,7 @@ |
||
| 151 | 151 | $columns = array_keys($this->columns); |
| 152 | 152 | $key = array_search($columnName, $columns); |
| 153 | 153 | |
| 154 | - if ($key>=1) |
|
| 154 | + if ($key >= 1) |
|
| 155 | 155 | { |
| 156 | 156 | return $columns[$key - 1]; |
| 157 | 157 | } |
@@ -257,14 +257,14 @@ discard block |
||
| 257 | 257 | $this->tableName); |
| 258 | 258 | |
| 259 | 259 | AuditDataLayer::createAuditTrigger($this->dataSchemaName, |
| 260 | - $this->auditSchemaName, |
|
| 261 | - $this->tableName, |
|
| 262 | - $triggerName, |
|
| 263 | - $action, |
|
| 264 | - $this->additionalAuditColumns, |
|
| 265 | - $this->dataTableColumnsDatabase, |
|
| 266 | - $skipVariable, |
|
| 267 | - $additionSql); |
|
| 260 | + $this->auditSchemaName, |
|
| 261 | + $this->tableName, |
|
| 262 | + $triggerName, |
|
| 263 | + $action, |
|
| 264 | + $this->additionalAuditColumns, |
|
| 265 | + $this->dataTableColumnsDatabase, |
|
| 266 | + $skipVariable, |
|
| 267 | + $additionSql); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -333,29 +333,29 @@ discard block |
||
| 333 | 333 | * @param TableColumnsMetadata $alteredColumns The metadata of the altered columns. |
| 334 | 334 | */ |
| 335 | 335 | private function logColumnInfo(TableColumnsMetadata $newColumns, |
| 336 | - TableColumnsMetadata $obsoleteColumns, |
|
| 337 | - TableColumnsMetadata $alteredColumns): void |
|
| 336 | + TableColumnsMetadata $obsoleteColumns, |
|
| 337 | + TableColumnsMetadata $alteredColumns): void |
|
| 338 | 338 | { |
| 339 | 339 | foreach ($newColumns->getColumns() as $column) |
| 340 | 340 | { |
| 341 | 341 | $this->io->logInfo('New column <dbo>%s.%s</dbo>', |
| 342 | - $this->tableName, |
|
| 343 | - $column->getName()); |
|
| 342 | + $this->tableName, |
|
| 343 | + $column->getName()); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | foreach ($obsoleteColumns->getColumns() as $column) |
| 347 | 347 | { |
| 348 | 348 | $this->io->logInfo('Obsolete column <dbo>%s.%s</dbo>', |
| 349 | - $this->tableName, |
|
| 350 | - $column->getName()); |
|
| 349 | + $this->tableName, |
|
| 350 | + $column->getName()); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | foreach ($alteredColumns->getColumns() as $column) |
| 354 | 354 | { |
| 355 | 355 | $this->io->logInfo('Type of <dbo>%s.%s</dbo> has been altered to <dbo>%s</dbo>', |
| 356 | - $this->tableName, |
|
| 357 | - $column->getName(), |
|
| 358 | - $column->getProperty('column_type')); |
|
| 356 | + $this->tableName, |
|
| 357 | + $column->getName(), |
|
| 358 | + $column->getProperty('column_type')); |
|
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | //-------------------------------------------------------------------------------------------------------------------- |
| 42 | 42 | public function logDebug() |
| 43 | 43 | { |
| 44 | - if ($this->getVerbosity()>=OutputInterface::VERBOSITY_DEBUG) |
|
| 44 | + if ($this->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) |
|
| 45 | 45 | { |
| 46 | 46 | $args = func_get_args(); |
| 47 | 47 | $format = array_shift($args); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | //-------------------------------------------------------------------------------------------------------------------- |
| 54 | 54 | public function logInfo() |
| 55 | 55 | { |
| 56 | - if ($this->getVerbosity()>=OutputInterface::VERBOSITY_NORMAL) |
|
| 56 | + if ($this->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) |
|
| 57 | 57 | { |
| 58 | 58 | $args = func_get_args(); |
| 59 | 59 | $format = array_shift($args); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | //-------------------------------------------------------------------------------------------------------------------- |
| 66 | 66 | public function logNote() |
| 67 | 67 | { |
| 68 | - if ($this->getVerbosity()>=OutputInterface::VERBOSITY_NORMAL) |
|
| 68 | + if ($this->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) |
|
| 69 | 69 | { |
| 70 | 70 | $args = func_get_args(); |
| 71 | 71 | $format = array_shift($args); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | //-------------------------------------------------------------------------------------------------------------------- |
| 78 | 78 | public function logVerbose() |
| 79 | 79 | { |
| 80 | - if ($this->getVerbosity()>=OutputInterface::VERBOSITY_VERBOSE) |
|
| 80 | + if ($this->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) |
|
| 81 | 81 | { |
| 82 | 82 | $args = func_get_args(); |
| 83 | 83 | $format = array_shift($args); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | //-------------------------------------------------------------------------------------------------------------------- |
| 90 | 90 | public function logVeryVerbose() |
| 91 | 91 | { |
| 92 | - if ($this->getVerbosity()>=OutputInterface::VERBOSITY_VERY_VERBOSE) |
|
| 92 | + if ($this->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE) |
|
| 93 | 93 | { |
| 94 | 94 | $args = func_get_args(); |
| 95 | 95 | $format = array_shift($args); |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | protected function configure() |
| 22 | 22 | { |
| 23 | 23 | $this->setName('drop-triggers') |
| 24 | - ->setDescription('Drops all triggers') |
|
| 25 | - ->setHelp('Drops all triggers (including triggers not created by audit) from all tables (including tables '. |
|
| 26 | - 'excluded for auditing) in the data schema.') |
|
| 27 | - ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file'); |
|
| 24 | + ->setDescription('Drops all triggers') |
|
| 25 | + ->setHelp('Drops all triggers (including triggers not created by audit) from all tables (including tables '. |
|
| 26 | + 'excluded for auditing) in the data schema.') |
|
| 27 | + ->addArgument('config file', InputArgument::REQUIRED, 'The audit configuration file'); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | //-------------------------------------------------------------------------------------------------------------------- |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | foreach ($triggers as $trigger) |
| 60 | 60 | { |
| 61 | 61 | $this->io->logInfo('Dropping trigger <dbo>%s</dbo> from table <dbo>%s</dbo>', |
| 62 | - $trigger['trigger_name'], |
|
| 63 | - $trigger['table_name']); |
|
| 62 | + $trigger['trigger_name'], |
|
| 63 | + $trigger['table_name']); |
|
| 64 | 64 | |
| 65 | 65 | AuditDataLayer::dropTrigger($dataSchema, $trigger['trigger_name']); |
| 66 | 66 | } |