diff options
| author | Tristan Zur <tzur@ccwn.org> | 2012-04-28 13:42:41 +0200 |
|---|---|---|
| committer | Tristan Zur <tzur@ccwn.org> | 2012-04-28 13:42:41 +0200 |
| commit | 2d4bddcbf7b816f86db6f308a4d11bc9787c1f99 (patch) | |
| tree | cb19c5a13d6fcf87c8a9a3eb5dbba4920ca1969f /protected/modules/auditTrail/migrations | |
| parent | c98745edd2c7b2f48bc3493c4dd9a061376c4720 (diff) | |
- Veranstaltungen CRUD Basisimplementierung
- Extension "CJuiDateTimePicker" hinzugefügt
- Modul "AuditTrail" hinzugefügt
Diffstat (limited to 'protected/modules/auditTrail/migrations')
| -rw-r--r-- | protected/modules/auditTrail/migrations/m110517_155003_create_tables_audit_trail.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/protected/modules/auditTrail/migrations/m110517_155003_create_tables_audit_trail.php b/protected/modules/auditTrail/migrations/m110517_155003_create_tables_audit_trail.php new file mode 100644 index 0000000..e4a2428 --- /dev/null +++ b/protected/modules/auditTrail/migrations/m110517_155003_create_tables_audit_trail.php @@ -0,0 +1,66 @@ +<?php + +class m110517_155003_create_tables_audit_trail extends CDbMigration +{ + + /** + * Creates initial version of the audit trail table + */ + public function up() + { + + //Create our first version of the audittrail table + //Please note that this matches the original creation of the + //table from version 1 of the extension. Other migrations will + //upgrade it from here if we ever need to. This was done so + //that older versions can still use migrate functionality to upgrade. + $this->createTable( 'tbl_audit_trail', + array( + 'id' => 'pk', + 'old_value' => 'string', + 'new_value' => 'string', + 'action' => 'string NOT NULL', + 'model' => 'string NOT NULL', + 'field' => 'string NOT NULL', + 'stamp' => 'datetime NOT NULL', + 'user_id' => 'string', + 'model_id' => 'string NOT NULL', + ) + ); + + //Index these bad boys for speedy lookups + $this->createIndex( 'idx_audit_trail_user_id', 'tbl_audit_trail', 'user_id'); + $this->createIndex( 'idx_audit_trail_model_id', 'tbl_audit_trail', 'model_id'); + $this->createIndex( 'idx_audit_trail_model', 'tbl_audit_trail', 'model'); + $this->createIndex( 'idx_audit_trail_field', 'tbl_audit_trail', 'field'); + $this->createIndex( 'idx_audit_trail_old_value', 'tbl_audit_trail', 'old_value'); + $this->createIndex( 'idx_audit_trail_new_value', 'tbl_audit_trail', 'new_value'); + $this->createIndex( 'idx_audit_trail_action', 'tbl_audit_trail', 'action'); + } + + /** + * Drops the audit trail table + */ + public function down() + { + $this->dropTable( 'tbl_audit_trail' ); + } + + /** + * Creates initial version of the audit trail table in a transaction-safe way. + * Uses $this->up to not duplicate code. + */ + public function safeUp() + { + $this->up(); + } + + /** + * Drops the audit trail table in a transaction-safe way. + * Uses $this->down to not duplicate code. + */ + public function safeDown() + { + $this->down(); + } +}
\ No newline at end of file |
