createTable( 'tbl_audit_trail', array( 'id' => 'pk', 'old_value' => 'text', 'new_value' => 'text', '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_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(); } }