-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Audittrail table column action changed to enum field type
- Loading branch information
Showing
2 changed files
with
39 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use yii\db\Schema; | ||
use yii\db\Migration; | ||
use sammaye\audittrail\LoggableBehavior; | ||
|
||
class m161004_132206_change_action_field extends Migration | ||
{ | ||
public function up() | ||
{ | ||
|
||
$this->alterColumn('tbl_audit_trail', 'action', "ENUM('".LoggableBehavior::ACTION_CHANGE."', '".LoggableBehavior::ACTION_CREATE."', '".LoggableBehavior::ACTION_DELETE."', '".LoggableBehavior::ACTION_SET."') NOT NULL"); | ||
|
||
} | ||
|
||
public function down() | ||
{ | ||
$this->alterColumn('tbl_audit_trail', 'action', Schema::TYPE_STRING . ' NOT NULL'); | ||
} | ||
|
||
// Use safeUp/safeDown to run migration code within a transaction | ||
public function safeUp() | ||
{ | ||
$this->up(); | ||
} | ||
|
||
public function safeDown() | ||
{ | ||
$this->down(); | ||
} | ||
} |