// create the database table
public function beforeEnable()
{
Yii::app()->getDb()->createCommand('
CREATE TABLE IF NOT EXISTS `{{backup_manager_snapshot}}` (
`snapshot_id` INT NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL,
`path` VARCHAR(255) NOT NULL,
`size` INT(11) NOT NULL,
`meta_data` BLOB NULL,
`date_added` DATETIME NOT NULL,
PRIMARY KEY (`snapshot_id`))
ENGINE=InnoDB CHARSET=utf8;
')->execute();
return true;
}
// drop the table
public function beforeDelete()
{
Yii::import('ext-backup-manager.common.models.*');
BackupManagerSnapshot::model()->deleteAllBackups();
Yii::app()->getDb()->createCommand('DROP TABLE IF EXISTS `{{backup_manager_snapshot}}`')->execute();
return true;
}