-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display the new column type when logging altered table columns.
- Loading branch information
Showing
7 changed files
with
77 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace SetBased\Audit\Test\MySql\AuditCommand\AlterColumn; | ||
|
||
use SetBased\Audit\MySql\AuditDataLayer; | ||
use SetBased\Audit\Test\MySql\AuditCommand\AuditCommandTestCase; | ||
|
||
/** | ||
* Tests for running audit with an altered table column. | ||
*/ | ||
class AlterColumnTest extends AuditCommandTestCase | ||
{ | ||
//-------------------------------------------------------------------------------------------------------------------- | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function setUpBeforeClass(): void | ||
{ | ||
self::$dir = __DIR__; | ||
|
||
parent::setUpBeforeClass(); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------------------------- | ||
public function test01(): void | ||
{ | ||
$this->runAudit(); | ||
|
||
AuditDataLayer::$dl->executeMulti(file_get_contents(__DIR__.'/config/alter_column.sql')); | ||
|
||
$output = $this->runAudit(); | ||
self::assertSame('Type of TABLE1.c2 has been altered to varchar(80)', trim($output)); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------------------------------------- | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alter table `TABLE1` modify `c2` varchar(80); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"database": { | ||
"credentials": "credentials.ini" | ||
}, | ||
"tables": { | ||
"TABLE1": { | ||
"audit": true, | ||
"skip": null, | ||
"alias": "t1" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[database] | ||
host = 127.0.0.1 | ||
user = test | ||
password = test | ||
data_schema = test_data | ||
audit_schema = test_audit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
create table `TABLE1` ( | ||
c1 tinyint, | ||
c2 varchar(40), | ||
c4 int | ||
); | ||
|