repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200309_175000__update_data__cms_user_property.php | src/migrations/m200309_175000__update_data__cms_user_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200309_175000__update_data__cms_user_property extends Migration
{
public function safeUp()
{
$tableName = "cms_user_property";
$tablePropertyName = "cms_user_universal_property";
$tablePropertyEnumName = "cms_user_universal_property_enum";
$subQuery = $this->db->createCommand("SELECT
{$tableName}.id
FROM
`{$tableName}`
LEFT JOIN {$tablePropertyName} on {$tablePropertyName}.id = {$tableName}.property_id
LEFT JOIN {$tablePropertyEnumName} on {$tablePropertyEnumName}.id = {$tableName}.value_enum
where
{$tablePropertyName}.property_type = 'L'")->queryAll();
$this->update("{$tableName}", [
'value_enum_id' => new \yii\db\Expression("{$tableName}.value_enum"),
], [
"in",
"id",
$subQuery,
]);
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m201006_111000__alter_table__cms_storage_file.php | src/migrations/m201006_111000__alter_table__cms_storage_file.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m201006_111000__alter_table__cms_storage_file extends Migration
{
public function safeUp()
{
$tableName = 'cms_storage_file';
$this->addColumn($tableName, "external_id", $this->string(255)->null());
$this->createIndex("external_id", $tableName, ["external_id", "cms_site_id"], true);
}
public function safeDown()
{
echo "m191227_015615__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200720_110601__create_table__cms_site_address_phone.php | src/migrations/m200720_110601__create_table__cms_site_address_phone.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200720_110601__create_table__cms_site_address_phone extends Migration
{
public function safeUp()
{
$tableName = 'cms_site_address_phone';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_site_address_id' => $this->integer()->notNull(),
'value' => $this->string(255)->notNull(),
'name' => $this->string(),
'priority' => $this->integer()->notNull()->defaultValue(100),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_site_address_id', $tableName, 'cms_site_address_id');
$this->createIndex($tableName.'__priority', $tableName, 'priority');
$this->createIndex($tableName.'__value_uniq', $tableName, ['cms_site_address_id', 'value'], true);
$this->addCommentOnTable($tableName, 'Телефоны сайта');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
//Удаляя сайт - удаляются и все его телефоны
$this->addForeignKey(
"{$tableName}__cms_site_address_id", $tableName,
'cms_site_address_id', '{{%cms_site_address}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200309_101000__alter_table__cms_tree_type_property.php | src/migrations/m200309_101000__alter_table__cms_tree_type_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200309_101000__alter_table__cms_tree_type_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_tree_type_property}}", "cms_measure_code", $this->string(20));
$this->addForeignKey(
"cms_tree_type_property__measure_code", "{{%cms_tree_type_property}}",
'cms_measure_code', '{{%cms_measure}}', 'code', 'RESTRICT', 'CASCADE'
);
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200309_155000__update_data__cms_content_element_property.php | src/migrations/m200309_155000__update_data__cms_content_element_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200309_155000__update_data__cms_content_element_property extends Migration
{
public function safeUp()
{
$tableName = 'cms_content_element_property';
$subQuery = $this->db->createCommand("
DELETE FROM
cms_content_element_property USING cms_content_element_property
LEFT JOIN cms_content_property on cms_content_property.id = cms_content_element_property.property_id
LEFT JOIN cms_content_property_enum on cms_content_property_enum.id = cms_content_element_property.value_enum
WHERE
cms_content_property.property_type = 'L' AND
cms_content_property_enum.id is null
")->execute();
$subQuery = $this->db->createCommand("
UPDATE
`cms_content_element_property` as p
LEFT JOIN cms_content_property on cms_content_property.id = p.property_id
/*LEFT JOIN cms_content_property_enum on cms_content_property_enum.id = p.value_enum */
SET
p.`value_enum_id` = p.value_enum
WHERE
cms_content_property.property_type = 'L'
")->execute();
/*$subQuery = $this->db->createCommand("SELECT
{$tableName}.id
FROM
`{$tableName}`
LEFT JOIN cms_content_property on cms_content_property.id = {$tableName}.property_id
LEFT JOIN cms_content_property_enum on cms_content_property_enum.id = {$tableName}.value_enum
where
cms_content_property.property_type = 'L'")->queryAll();
$this->update("{$tableName}", [
'value_enum_id' => new \yii\db\Expression("{$tableName}.value_enum"),
], [
"in",
"id",
$subQuery,
]);*/
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m240717_182301__create_table__cms_company2user.php | src/migrations/m240717_182301__create_table__cms_company2user.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240717_182301__create_table__cms_company2user extends Migration
{
public function safeUp()
{
$tableName = 'cms_company2user';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_company_id' => $this->integer()->notNull()->comment("Компания"),
'cms_user_id' => $this->integer()->notNull()->comment("Пользователь"),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_company_id', $tableName, ['cms_company_id']);
$this->createIndex($tableName.'__cms_user_id', $tableName, ['cms_user_id']);
$this->createIndex($tableName.'__uniq', $tableName, ['cms_user_id', 'cms_company_id'], true);
$this->addCommentOnTable($tableName, 'Связь пользователей и контрагентов');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_company_id", $tableName,
'cms_company_id', '{{%cms_company}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_user_id", $tableName,
'cms_user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m251022_152301__create_table__cms_faq.php | src/migrations/m251022_152301__create_table__cms_faq.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m251022_152301__create_table__cms_faq extends Migration
{
public function safeUp()
{
$tableName = 'cms_faq';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_at' => $this->integer()->null(),
'created_by' => $this->integer()->null(),
'name' => $this->string(255)->notNull(),
'response' => $this->text()->notNull(),
'is_active' => $this->integer(1)->notNull()->defaultValue(1),
'priority' => $this->integer()->notNull()->defaultValue(500),
], $tableOptions);
$this->createIndex($tableName.'__is_active', $tableName, 'is_active');
$this->createIndex($tableName.'__priority', $tableName, 'priority');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__name', $tableName, 'name');
$this->addCommentOnTable($tableName, 'Вопрос/Ответ');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m240530_132301__create_table__cms_company cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m240319_132301__alter_table__cms_storage_file_sx_data.php | src/migrations/m240319_132301__alter_table__cms_storage_file_sx_data.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240319_132301__alter_table__cms_storage_file_sx_data extends Migration
{
public function safeUp()
{
$this->addColumn("cms_storage_file", "sx_data", $this->text()->null());
}
public function safeDown()
{
echo "m200717_132301__alter_table__shop_site cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m250219_152301__create_table__cms_project2user.php | src/migrations/m250219_152301__create_table__cms_project2user.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m250219_152301__create_table__cms_project2user extends Migration
{
public function safeUp()
{
$tableName = 'cms_project2user';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_project_id' => $this->integer()->notNull()->comment("Проект"),
'cms_user_id' => $this->integer()->notNull()->comment("Пользователь"),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_project_id', $tableName, ['cms_project_id']);
$this->createIndex($tableName.'__cms_user_id', $tableName, ['cms_user_id']);
$this->createIndex($tableName.'__uniq', $tableName, ['cms_user_id', 'cms_project_id'], true);
$this->addCommentOnTable($tableName, 'Связь сотрудников и проектов');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_project_id", $tableName,
'cms_project_id', '{{%cms_project}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_user_id", $tableName,
'cms_user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m190412_235515__alter_table__cms_lang.php | src/migrations/m190412_235515__alter_table__cms_lang.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m190412_235515__alter_table__cms_lang extends Migration
{
public function safeUp()
{
$this->dropColumn("{{%cms_lang}}", "is_default");
}
public function safeDown()
{
echo "m190412_235515__alter_table__cms_lang cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m220705_110601__create_table__cms_callcheck_provider.php | src/migrations/m220705_110601__create_table__cms_callcheck_provider.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m220705_110601__create_table__cms_callcheck_provider extends Migration
{
public function safeUp()
{
$tableName = 'cms_callcheck_provider';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_site_id' => $this->integer()->notNull(),
'name' => $this->string()->notNull(),
'priority' => $this->integer()->notNull()->defaultValue(100),
'is_main' => $this->integer()->defaultValue(1),
'component' => $this->string(255)->notNull(),
'component_config' => $this->text(),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__is_main', $tableName, 'is_main');
$this->createIndex($tableName.'__cms_site_id', $tableName, 'cms_site_id');
$this->createIndex($tableName.'__priority', $tableName, 'priority');
$this->createIndex($tableName.'__name', $tableName, 'name');
$this->createIndex($tableName.'__site_main_uniq', $tableName, ['cms_site_id', 'is_main'], true);
$this->addCommentOnTable($tableName, 'Авторизация по звонку провайдеры');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
//Удаляя сайт - удаляются и все его телефоны
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m251127_132301__alter_table__cms_content_property.php | src/migrations/m251127_132301__alter_table__cms_content_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m251127_132301__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$tableName = "cms_content_property";
$this->addColumn($tableName, "is_sticker", $this->integer(1)->comment("Стикер"));
$this->createIndex($tableName. "__is_sticker", $tableName, ["is_sticker", "cms_site_id"], true);
}
public function safeDown()
{
echo "m200717_132301__alter_table__shop_site cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m220705_120601__create_table__cms_callcheck_message.php | src/migrations/m220705_120601__create_table__cms_callcheck_message.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m220705_120601__create_table__cms_callcheck_message extends Migration
{
public function safeUp()
{
$tableName = 'cms_callcheck_message';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'user_ip' => $this->string(20),
'cms_site_id' => $this->integer()->notNull(),
'cms_callcheck_provider_id' => $this->integer(),
'phone' => $this->string()->notNull(),
'status' => $this->string(255)->notNull(),
'code' => $this->string(255),
'error_message' => $this->string(255),
'provider_status' => $this->string(255),
'provider_call_id' => $this->string(255),
'provider_response_data' => $this->text(),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_site_id', $tableName, 'cms_site_id');
$this->createIndex($tableName.'__status', $tableName, ['status']);
$this->createIndex($tableName.'__code', $tableName, ['code']);
$this->createIndex($tableName.'__provider_status', $tableName, ['provider_status']);
$this->createIndex($tableName.'__provider_call_id', $tableName, ['provider_call_id']);
$this->addCommentOnTable($tableName, 'Авторзиация по звонку сообщения');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
//Удаляя сайт - удаляются и все его телефоны
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_callcheck_provider_id", $tableName,
'cms_callcheck_provider_id', '{{%cms_callcheck_provider}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m240530_132301__create_table__cms_company.php | src/migrations/m240530_132301__create_table__cms_company.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240530_132301__create_table__cms_company extends Migration
{
public function safeUp()
{
$tableName = 'cms_company';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer()->null(),
'created_at' => $this->integer()->null(),
'name' => $this->string(255)->notNull()->comment("Название"),
'cms_image_id' => $this->integer(11)->null()->comment("Изображение"),
'description' => $this->text()->null()->comment("Описание"),
'company_type' => $this->string(255)->notNull()->defaultValue("client")->comment("Тип клиент/поставщик"),
], $tableOptions);
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__name', $tableName, 'name');
$this->createIndex($tableName.'__cms_image_id', $tableName, 'cms_image_id');
$this->createIndex($tableName.'__company_type', $tableName, 'company_type');
$this->addCommentOnTable($tableName, 'Компании');
$this->addForeignKey(
"{$tableName}__cms_image_id", $tableName,
'cms_image_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m240530_132301__create_table__cms_company cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m191004_015515__alter_table__cms_content_element.php | src/migrations/m191004_015515__alter_table__cms_content_element.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m191004_015515__alter_table__cms_content_element extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content_element}}", "seo_h1", $this->string(255)->notNull());
$this->createIndex("seo_h1", "{{%cms_content_element}}", "seo_h1");
}
public function safeDown()
{
echo "m191004_015515__alter_table__cms_content_element cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m240717_142301__create_table__cms_company_phone.php | src/migrations/m240717_142301__create_table__cms_company_phone.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240717_142301__create_table__cms_company_phone extends Migration
{
public function safeUp()
{
$tableName = 'cms_company_phone';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_company_id' => $this->integer()->notNull(),
'value' => $this->string(255)->notNull()->comment("Телефон"),
'name' => $this->string(255)->comment("Примечание к телефону"),
'sort' => $this->integer()->notNull()->defaultValue(500),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_company_id', $tableName, ['cms_company_id']);
$this->createIndex($tableName.'__uniq2company', $tableName, ['cms_company_id', 'value'], true);
$this->createIndex($tableName.'__sort', $tableName, ['sort']);
$this->addCommentOnTable($tableName, 'Телефоны компаний');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
//Удаляя компанию - удаляются и все email
$this->addForeignKey(
"{$tableName}__cms_company_id", $tableName,
'cms_company_id', '{{%cms_company}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m221121_132301__alter_table__cms_component_settings.php | src/migrations/m221121_132301__alter_table__cms_component_settings.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m221121_132301__alter_table__cms_component_settings extends Migration
{
public function safeUp()
{
$tableName = "cms_component_settings";
$this->execute("ALTER TABLE `cms_component_settings` CHANGE `value` `value` LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL;");
}
public function safeDown()
{
echo "m200717_132301__alter_table__shop_site cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m190613_015515__alter_table__cms_content.php | src/migrations/m190613_015515__alter_table__cms_content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m190613_015515__alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content}}", "is_count_views", $this->integer(1)->notNull()->defaultValue(0));
$this->createIndex("is_count_views", "{{%cms_content}}", "is_count_views");
}
public function safeDown()
{
echo "m190613_015515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m250313_132302__create_table__cms_user_schedule.php | src/migrations/m250313_132302__create_table__cms_user_schedule.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m250313_132302__create_table__cms_user_schedule extends Migration
{
public function safeUp()
{
$tableName = 'cms_user_schedule';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey()->notNull(),
'created_by' => $this->integer(11),
'created_at' => $this->integer(11),
'cms_user_id' => $this->integer(11)->comment("Сотрудник"),
'start_at' => $this->integer()->comment("Начало работы"),
'end_at' => $this->integer()->null()->comment("Завершение работы"),
], $tableOptions);
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__start_at', $tableName, 'start_at');
$this->createIndex($tableName.'__end_at', $tableName, 'end_at');
$this->createIndex($tableName.'__cms_user_id', $tableName, 'cms_user_id');
$this->addCommentOnTable($tableName, 'Рабочее время сотрудника');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_user_id", $tableName,
'cms_user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "cms_user_schedule cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m231225_132301__alter_table__cms_content.php | src/migrations/m231225_132301__alter_table__cms_content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m231225_132301__alter_table__cms_content extends Migration
{
public function safeUp()
{
$tableName = "cms_content";
$this->dropForeignKey("cms_content_cms_content_type", $tableName);
$this->alterColumn($tableName, "content_type", $this->string(32)->defaultValue(null)->null());
$this->addForeignKey(
"{$tableName}__content_type", $tableName,
'content_type', '{{%cms_content_type}}', 'code', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m200717_132301__alter_table__shop_site cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m230609_132301__alter_table__cms_storage_file.php | src/migrations/m230609_132301__alter_table__cms_storage_file.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m230609_132301__alter_table__cms_storage_file extends Migration
{
public function safeUp()
{
$tableName = "cms_storage_file";
$this->alterColumn($tableName, "mime_type", $this->string(255)->null());
}
public function safeDown()
{
echo "m200717_132301__alter_table__shop_site cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200309_162000__alter_table__cms_tree_property.php | src/migrations/m200309_162000__alter_table__cms_tree_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200309_162000__alter_table__cms_tree_property extends Migration
{
public function safeUp()
{
$tableName = "cms_tree_property";
$this->addColumn($tableName, "value_element_id", $this->integer());
$this->createIndex("value_element_id", $tableName, "value_element_id");
$this->addForeignKey(
"{$tableName}__value_cms_element_id", $tableName,
'value_element_id', '{{%cms_content_element}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200129_075515__alter_table__cms_content.php | src/migrations/m200129_075515__alter_table__cms_content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m200129_075515__alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content}}", "is_access_check_element", $this->integer(1)->notNull()->defaultValue(0));
$this->update("{{%cms_content}}", ['is_access_check_element' => 1], ['access_check_element' => 'Y']);
$this->dropColumn("{{%cms_content}}", "access_check_element");
}
public function safeDown()
{
echo "m200129_075515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m190820_015515__alter_table__cms_user_email.php | src/migrations/m190820_015515__alter_table__cms_user_email.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m190820_015515__alter_table__cms_user_email extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_user_email}}", "is_approved", $this->integer(1)->unsigned()->comment("Email подтвержден?")->notNull()->defaultValue(0));
$this->addColumn("{{%cms_user_email}}", "is_main", $this->integer(1)->unsigned()->comment("Email главный у пользователя?")->notNull()->defaultValue(0));
$this->dropColumn("{{%cms_user_email}}", "def");
$this->dropColumn("{{%cms_user_email}}", "approved");
$this->createIndex("is_approved", "{{%cms_user_email}}", "is_approved");
$this->createIndex("is_main", "{{%cms_user_email}}", "is_main");
$this->addColumn("{{%cms_user_email}}", "approved_key_at", $this->integer()->comment("Время генерации и отправки ключа?"));
$this->createIndex("approved_key_at", "{{%cms_user_email}}", "approved_key_at");
}
public function safeDown()
{
echo "m190621_015515__alter_table__cms_site_domain cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m220603_090601__create_table__cms_user_address.php | src/migrations/m220603_090601__create_table__cms_user_address.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m220603_090601__create_table__cms_user_address extends Migration
{
public function safeUp()
{
$tableName = 'cms_user_address';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_user_id' => $this->integer()->notNull(),
'cms_site_id' => $this->integer()->notNull(),
'name' => $this->string(255)->comment("Название адреса (необязательное)"),
'value' => $this->string(255)->notNull()->comment("Полный адрес"),
'latitude' => $this->double()->notNull()->comment("Широта"),
'longitude' => $this->double()->notNull()->comment("Долгота"),
'entrance' => $this->string(255)->comment("Подъезд"),
'floor' => $this->string(255)->comment("Этаж"),
'apartment_number' => $this->string(255)->comment("Номер квартиры"),
'comment' => $this->text()->comment("Комментарий"),
'cms_image_id' => $this->integer()->comment("Фото адреса"),
'priority' => $this->integer()->notNull()->defaultValue(100),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_site_id', $tableName, 'cms_site_id');
$this->createIndex($tableName.'__priority', $tableName, 'priority');
$this->createIndex($tableName.'__value_uniq', $tableName, ['cms_user_id', 'value']);
$this->createIndex($tableName.'__name_uniq', $tableName, ['cms_user_id', 'name'], true);
$this->createIndex($tableName.'__coordinates', $tableName, ['cms_user_id', 'latitude', 'longitude']);
$this->createIndex($tableName.'__cms_image_id', $tableName, ['cms_image_id']);
$this->addCommentOnTable($tableName, 'Адреса пользователя');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
//Удаляя сайт - удаляются и все его телефоны
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
//Удаляя пользователя - удаляются и все email
$this->addForeignKey(
"{$tableName}__cms_user_id", $tableName,
'cms_user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_image_id", $tableName,
'cms_image_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m220704_100601__alter_table__cms_contractor_map.php | src/migrations/m220704_100601__alter_table__cms_contractor_map.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m220704_100601__alter_table__cms_contractor_map extends Migration
{
public function safeUp()
{
$tableName = "cms_contractor_map";
$this->createIndex($tableName.'__cms_contractor_tmp_id', $tableName, ['cms_contractor_id']);
$this->dropIndex($tableName.'__cms_contractor_id', $tableName);
$this->createIndex($tableName.'__uniq_user_contractor', $tableName, ['cms_contractor_id', 'cms_user_id'], true);
$this->dropIndex($tableName.'__cms_contractor_tmp_id', $tableName);
$this->createIndex($tableName.'__cms_contractor_id', $tableName, ['cms_contractor_id']);
}
public function safeDown()
{
echo "m191227_015615__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m221019_132301__alter_table__cms_content_property.php | src/migrations/m221019_132301__alter_table__cms_content_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m221019_132301__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$tableName = "cms_content_property";
$this->addColumn($tableName, "is_country", $this->integer(1)->comment("Страна"));
$this->addColumn($tableName, "is_vendor", $this->integer(1)->comment("Производитель"));
$this->addColumn($tableName, "is_vendor_code", $this->integer(1)->comment("Код производителя"));
$this->addColumn($tableName, "is_offer_property", $this->integer(1)->comment("Свойство модификации"));
$this->createIndex("is_vendor", $tableName, ["is_vendor", "cms_site_id"], true);
$this->createIndex("is_vendor_code", $tableName, ["is_vendor_code", "cms_site_id"], true);
$this->createIndex("is_country", $tableName, ["is_country", "cms_site_id"], true);
}
public function safeDown()
{
echo "m200717_132301__alter_table__shop_site cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m140506_102106_rbac_init.php | src/migrations/m140506_102106_rbac_init.php | <?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
use yii\base\InvalidConfigException;
use yii\db\Schema;
use yii\rbac\DbManager;
/**
* Initializes RBAC tables
*
* @author Alexander Kochetov <creocoder@gmail.com>
* @since 2.0
*/
class m140506_102106_rbac_init extends \yii\db\Migration
{
public function safeUp()
{
if ($this->db->driverName === 'mysql') {
$filePath = __DIR__ . "/_mysql-init-dump.sql";
$file = fopen($filePath, "r");
if (!$file) {
throw new \Exception("Unable to open file: '{$filePath}'");
}
$sql = fread($file, filesize($filePath));
fclose($file);
$this->compact = true;
$this->execute($sql);
} else {
if ($this->db->driverName === 'pgsql') {
$filePath = __DIR__ . "/_pgsql-init-dump.sql";
$file = fopen($filePath, "r");
if (!$file) {
throw new \Exception("Unable to open file: '{$filePath}'");
}
$sql = fread($file, filesize($filePath));
fclose($file);
/*$this->db->pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true);
$this->compact = true;
$this->execute($sql);
*/
$this->compact = true;
$pdo = $this->db->masterPdo;
$pdo->exec($sql);
} else {
echo "Error for driver {$this->db->driverName} cannot be reverted.\n";
return false;
}
}
}
public function down()
{
echo "m140506_102106_rbac_init cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m191020_015515__alter_table__cms_user_email.php | src/migrations/m191020_015515__alter_table__cms_user_email.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m191020_015515__alter_table__cms_user_email extends Migration
{
public function safeUp()
{
$this->dropForeignKey("cms_user_email_user_id", "{{%cms_user_email}}");
$this->dropIndex("user_id", "{{%cms_user_email}}");
$this->renameColumn("{{%cms_user_email}}", "user_id", "cms_user_id");
$this->createIndex("cms_user_id", "{{%cms_user_email}}", "cms_user_id");
$this->addForeignKey(
"cms_user_email__cms_user_id", "{{%cms_user_email}}",
'cms_user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m190621_015515__alter_table__cms_site_domain cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200516_101000__alter_table__cms_content_property.php | src/migrations/m200516_101000__alter_table__cms_content_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200516_101000__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$tableName = "cms_content_property";
$this->dropForeignKey("cms_content_property_content_id", $tableName);
$this->dropColumn($tableName, "content_id");
}
public function safeDown()
{
echo "m200410_121000__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m201109_121000__alter_table__cms_content.php | src/migrations/m201109_121000__alter_table__cms_content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m201109_121000__alter_table__cms_content extends Migration
{
public function safeUp()
{
$tableName = 'cms_content';
$this->addColumn($tableName, "is_show_on_all_sites", $this->integer(1)->defaultValue(0)->comment("Элементы контента показывать на всех сайтах?"));
}
public function safeDown()
{
echo "m191227_015615__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200406_171000__alter_table__cms_site.php | src/migrations/m200406_171000__alter_table__cms_site.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200406_171000__alter_table__cms_site extends Migration
{
public function safeUp()
{
$tableName = "cms_site";
$this->addColumn($tableName, "is_active", $this->integer(1)->unsigned()->notNull()->defaultValue(1));
$this->update($tableName, ['is_active' => 0], ['active' => 'N']);
$this->addColumn($tableName, "is_default", $this->integer(1)->unsigned());
$this->update($tableName, ['is_default' => 1], ['def' => 'Y']);
$this->createIndex("is_default", $tableName, ["is_default"], true);
$this->dropColumn($tableName, "def");
$this->dropColumn($tableName, "active");
$this->renameColumn($tableName, "code", "_to_del_code");
}
public function safeDown()
{
echo "m200406_101000__drop_to_del_columns cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200309_154000__alter_table__cms_content_element_property.php | src/migrations/m200309_154000__alter_table__cms_content_element_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200309_154000__alter_table__cms_content_element_property extends Migration
{
public function safeUp()
{
$tableName = "cms_content_element_property";
$this->addColumn($tableName, "value_enum_id", $this->integer());
$this->createIndex("value_enum_id", $tableName, "value_enum_id");
$this->addForeignKey(
"{$tableName}}__value_enum_id", $tableName,
'value_enum_id', '{{%cms_content_property_enum}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m220601_010601__create_table__cms_contractor.php | src/migrations/m220601_010601__create_table__cms_contractor.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m220601_010601__create_table__cms_contractor extends Migration
{
public function safeUp()
{
$tableName = 'cms_contractor';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_site_id' => $this->integer()->notNull(),
'contractor_type' => $this->string()->notNull()->comment("Тип контрагента (Ип, Юр, Физ лицо)"),
'name' => $this->string()->comment("Название"),
'full_name' => $this->string()->comment("Полное название"),
'international_name' => $this->string()->comment("Интернациональное название"),
'first_name' => $this->string(),
'last_name' => $this->string(),
'patronymic' => $this->string(),
'inn' => $this->string(255)->comment("ИНН"),
'ogrn' => $this->string(255)->comment("ОГРН"),
'kpp' => $this->string(255)->comment("КПП"),
'okpo' => $this->string(255)->comment("ОКПО"),
'address' => $this->string(255)->comment("Адрес организации"),
'mailing_address' => $this->string(255)->comment("Почтовый адрес (для отправки писем)"),
'mailing_postcode' => $this->string(255)->comment("Почтовый индекс"),
'cms_image_id' => $this->integer()->comment("Фото"),
'stamp_id' => $this->integer()->comment("Печать"),
'director_signature_id' => $this->integer()->comment("Подпись директора"),
'signature_accountant_id' => $this->integer()->comment("Подпись гл. бухгалтера"),
'phone' => $this->string(255)->comment("Телефон"),
'email' => $this->string(255)->comment("Email"),
'is_our' => $this->integer(1)->defaultValue(0)->notNull()->comment("Это наш контрагент?"),
'description' => $this->text()->comment("Описание"),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__phone', $tableName, 'phone');
$this->createIndex($tableName.'__email', $tableName, 'email');
$this->createIndex($tableName.'__first_name', $tableName, 'first_name');
$this->createIndex($tableName.'__last_name', $tableName, 'last_name');
$this->createIndex($tableName.'__patronymic', $tableName, 'patronymic');
$this->createIndex($tableName.'__name', $tableName, 'name');
$this->createIndex($tableName.'__full_name', $tableName, 'full_name');
$this->createIndex($tableName.'__international_name', $tableName, 'international_name');
$this->createIndex($tableName.'__is_our', $tableName, 'is_our');
$this->createIndex($tableName.'__cms_site_id', $tableName, 'cms_site_id');
$this->createIndex($tableName.'__cms_site_id_inn', $tableName, ['cms_site_id', 'inn', 'contractor_type'], true);
$this->addCommentOnTable($tableName, 'Контрагенты');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_image_id", $tableName,
'cms_image_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__stamp_id", $tableName,
'stamp_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__director_signature_id", $tableName,
'director_signature_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__signature_accountant_id", $tableName,
'signature_accountant_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200307_125515__alter_table__cms_tree_type_property.php | src/migrations/m200307_125515__alter_table__cms_tree_type_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200307_125515__alter_table__cms_tree_type_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_tree_type_property}}", "is_multiple", $this->integer(1)->notNull()->defaultValue(0));
$this->update("{{%cms_tree_type_property}}", ['is_multiple' => 1], ['multiple' => 'Y']);
$this->createIndex("is_multiple", "{{%cms_tree_type_property}}", "is_multiple");
$this->renameColumn("{{%cms_tree_type_property}}", "multiple", "multiple__to_del");
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m190412_195515__alter_table__cms_lang.php | src/migrations/m190412_195515__alter_table__cms_lang.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m190412_195515__alter_table__cms_lang extends Migration
{
public function safeUp()
{
$this->dropColumn("{{%cms_lang}}", "def");
}
public function safeDown()
{
echo "m190412_195515__alter_table__cms_lang cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m221120_132301__alter_table__cms_content_element_property.php | src/migrations/m221120_132301__alter_table__cms_content_element_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m221120_132301__alter_table__cms_content_element_property extends Migration
{
public function safeUp()
{
$tableName = "cms_content_element_property";
$this->dropForeignKey("cms_content_element_property__created_by", $tableName);
$this->dropForeignKey("cms_content_element_property__updated_by", $tableName);
$this->dropIndex("updated_by", $tableName);
$this->dropIndex("created_by", $tableName);
$this->dropIndex("created_at", $tableName);
$this->dropIndex("updated_at", $tableName);
$this->dropColumn($tableName, "created_by");
$this->dropColumn($tableName, "updated_by");
$this->dropColumn($tableName, "created_at");
$this->dropColumn($tableName, "updated_at");
}
public function safeDown()
{
echo "m200717_132301__alter_table__shop_site cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m191004_015615__alter_table__cms_tree.php | src/migrations/m191004_015615__alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m191004_015615__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_tree}}", "seo_h1", $this->string(255)->notNull());
$this->createIndex("seo_h1", "{{%cms_tree}}", "seo_h1");
}
public function safeDown()
{
echo "m191004_015515__alter_table__cms_content_element cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200307_145515__alter_table__cms_tree_type_property.php | src/migrations/m200307_145515__alter_table__cms_tree_type_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200307_145515__alter_table__cms_tree_type_property extends Migration
{
public function safeUp()
{
$this->update("{{%cms_tree_type_property}}", ['is_required' => 0], ['is_required' => 'N']);
$this->update("{{%cms_tree_type_property}}", ['is_required' => 1], ['is_required' => 'Y']);
$this->alterColumn("{{%cms_tree_type_property}}", "is_required", $this->integer(1)->notNull()->defaultValue(0));
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200309_164000__alter_table__cms_tree_property.php | src/migrations/m200309_164000__alter_table__cms_tree_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200309_164000__alter_table__cms_tree_property extends Migration
{
public function safeUp()
{
$tableName = "cms_tree_property";
$this->addColumn($tableName, "value_enum_id", $this->integer());
$this->createIndex("value_enum_id", $tableName, "value_enum_id");
$this->addForeignKey(
"{$tableName}}__value_enum_id", $tableName,
'value_enum_id', '{{%cms_tree_type_property_enum}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m220130_010601__update_data__cms_user.php | src/migrations/m220130_010601__update_data__cms_user.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m220130_010601__update_data__cms_user extends Migration
{
public function safeUp()
{
$this->update("cms_user", ['username' => null], ['LIKE', 'username', 'id']);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200929_211000__alter_table__cms_storage_file.php | src/migrations/m200929_211000__alter_table__cms_storage_file.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m200929_211000__alter_table__cms_storage_file extends Migration
{
public function safeUp()
{
$tableName = "cms_storage_file";
$this->addColumn($tableName, "cms_site_id", $this->integer());
$this->createIndex("cms_site_id", $tableName, ['cms_site_id']);
$subQuery = $this->db->createCommand("
UPDATE
`cms_storage_file` as c
SET
c.cms_site_id = (select cms_site.id from cms_site where cms_site.is_default = 1)
")->execute();
$this->alterColumn($tableName, "cms_site_id", $this->integer()->notNull());
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', '{{%cms_site}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function safeDown()
{
echo "m190412_205515__alter_table__cms_lang cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200129_095515__alter_table__cms_content.php | src/migrations/m200129_095515__alter_table__cms_content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m200129_095515__alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content}}", "is_parent_content_required", $this->integer(1)->notNull()->defaultValue(0));
$this->update("{{%cms_content}}", ['is_parent_content_required' => 1], ['parent_content_is_required' => 'Y']);
$this->update("{{%cms_content}}", ['is_parent_content_required' => 0], ['parent_content_is_required' => 'N']);
$this->dropColumn("{{%cms_content}}", "parent_content_is_required");
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m250321_152301__create_table__cms_task_file.php | src/migrations/m250321_152301__create_table__cms_task_file.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m250321_152301__create_table__cms_task_file extends Migration
{
public function safeUp()
{
$tableName = 'cms_task_file';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer()->null(),
'created_at' => $this->integer()->null(),
'updated_by' => $this->integer()->null(),
'updated_at' => $this->integer()->null(),
'cms_task_id' => $this->integer()->notNull(),
'storage_file_id' => $this->integer()->notNull(),
'priority' => $this->integer()->notNull()->defaultValue(100),
], $tableOptions);
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_task_id', $tableName, ['cms_task_id']);
$this->createIndex($tableName.'__storage_file_id', $tableName, ['storage_file_id']);
$this->createIndex($tableName.'__uniq', $tableName, ['storage_file_id', 'cms_task_id'], true);
$this->addCommentOnTable($tableName, 'Файлы к задаче');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_task_id", $tableName,
'cms_task_id', '{{%cms_task}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__storage_file_id", $tableName,
'storage_file_id', '{{%cms_storage_file}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m240530_132301__create_table__cms_company cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m230526_132301__alter_table__cms_user.php | src/migrations/m230526_132301__alter_table__cms_user.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m230526_132301__alter_table__cms_user extends Migration
{
public function safeUp()
{
$tableName = "cms_user";
$this->alterColumn($tableName, "password_hash", $this->string(255)->null());
$this->alterColumn($tableName, "gender", $this->string(11)->null());
$this->addColumn($tableName, "birthday_at", $this->integer()->null());
$this->createIndex($tableName.'__birthday_at', $tableName, 'birthday_at');
$this->createIndex($tableName.'__gender', $tableName, 'gender');
$subQuery = $this->db->createCommand("
UPDATE
`cms_user` as c
SET
c.password_hash = null
")->execute();
}
public function safeDown()
{
echo "m200717_132301__alter_table__shop_site cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m220602_020601__create_table__cms_contractor_map.php | src/migrations/m220602_020601__create_table__cms_contractor_map.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m220602_020601__create_table__cms_contractor_map extends Migration
{
public function safeUp()
{
$tableName = 'cms_contractor_map';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_contractor_id' => $this->integer()->notNull()->comment("Контрагент"),
'cms_user_id' => $this->integer()->notNull()->comment("Пользователь"),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_contractor_id', $tableName, ['cms_contractor_id', 'cms_user_id'], true);
$this->addCommentOnTable($tableName, 'Связь пользователей и контрагентов');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_contractor_id", $tableName,
'cms_contractor_id', '{{%cms_contractor}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_user_id", $tableName,
'cms_user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m220127_152615__alter_table__cms_user.php | src/migrations/m220127_152615__alter_table__cms_user.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m220127_152615__alter_table__cms_user extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_user}}", "is_active", $this->integer(1)->notNull()->defaultValue(1));
$this->addColumn("{{%cms_user}}", "alias", $this->string(255)->comment("Псевдоним"));
$this->createIndex("is_active", "{{%cms_user}}", "is_active");
$this->createIndex("alias", "{{%cms_user}}", "alias");
}
public function safeDown()
{
echo "m190412_205515__alter_table__cms_lang cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m251126_192301__alter_table__cms_storage_file.php | src/migrations/m251126_192301__alter_table__cms_storage_file.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m251126_192301__alter_table__cms_storage_file extends Migration
{
public function safeUp()
{
//$tableName = '{{%cms_session}}';
$tableName = 'cms_storage_file';
$this->alterColumn($tableName, "name_to_save", $this->string(255)->null());
}
public function safeDown()
{
echo self::class;
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m180223_175515__alter_table__cms_storage_file.php | src/migrations/m180223_175515__alter_table__cms_storage_file.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m180223_175515__alter_table__cms_storage_file extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_storage_file}}", "priority", $this->integer()->notNull()->defaultValue(100));
$this->createIndex("cms_storage_file_priority", "{{%cms_storage_file}}", "priority");
}
public function safeDown()
{
echo "m180223_175515__alter_table__cms_storage_file cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200410_131000__update_data__cms_content_element.php | src/migrations/m200410_131000__update_data__cms_content_element.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200410_131000__update_data__cms_content_element extends Migration
{
public function safeUp()
{
$subQuery = $this->db->createCommand("
UPDATE
`cms_content_element` as c
SET
c.cms_site_id = (select cms_site.id from cms_site where cms_site.is_default = 1)
")->execute();
}
public function safeDown()
{
echo "m200410_121000__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200716_140601__create_table__cms_site_phone.php | src/migrations/m200716_140601__create_table__cms_site_phone.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200716_140601__create_table__cms_site_phone extends Migration
{
public function safeUp()
{
$tableName = 'cms_site_phone';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_site_id' => $this->integer()->notNull(),
'value' => $this->string(255)->notNull(),
'name' => $this->string(),
'priority' => $this->integer()->notNull()->defaultValue(100),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_site_id', $tableName, 'cms_site_id');
$this->createIndex($tableName.'__priority', $tableName, 'priority');
$this->createIndex($tableName.'__value_uniq', $tableName, ['cms_site_id', 'value'], true);
$this->addCommentOnTable($tableName, 'Телефоны сайта');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
//Удаляя сайт - удаляются и все его телефоны
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m190412_185515__update_data_table__cms_lang.php | src/migrations/m190412_185515__update_data_table__cms_lang.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m190412_185515__update_data_table__cms_lang extends Migration
{
public function safeUp()
{
$this->update("{{%cms_lang}}", ['is_default' => 1], ['def' => 'Y']);
}
public function safeDown()
{
echo "m190412_185515__update_data_table__cms_lang cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200717_101000__alter_table__cms_site.php | src/migrations/m200717_101000__alter_table__cms_site.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m200717_101000__alter_table__cms_site extends Migration
{
public function safeUp()
{
$tableName = "cms_site";
$this->addColumn($tableName, "favicon_storage_file_id", $this->integer()->comment("Favicon"));
$this->addColumn($tableName, "work_time", $this->text()->comment("Рабочее время"));
$this->createIndex("favicon_storage_file_id", $tableName, ['favicon_storage_file_id']);
$this->addForeignKey(
"{$tableName}__favicon_storage_file_id", $tableName,
'favicon_storage_file_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m190412_205515__alter_table__cms_lang cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200309_152000__alter_table__cms_content_element_property.php | src/migrations/m200309_152000__alter_table__cms_content_element_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200309_152000__alter_table__cms_content_element_property extends Migration
{
public function safeUp()
{
$tableName = "cms_content_element_property";
$this->addColumn($tableName, "value_element_id", $this->integer());
$this->createIndex("value_element_id", $tableName, "value_element_id");
$this->addForeignKey(
"{$tableName}__value_cms_element_id", $tableName,
'value_element_id', '{{%cms_content_element}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200716_150601__create_table__cms_site_email.php | src/migrations/m200716_150601__create_table__cms_site_email.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200716_150601__create_table__cms_site_email extends Migration
{
public function safeUp()
{
$tableName = 'cms_site_email';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_site_id' => $this->integer()->notNull(),
'value' => $this->string(255)->notNull(),
'name' => $this->string(),
'priority' => $this->integer()->notNull()->defaultValue(100),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_site_id', $tableName, 'cms_site_id');
$this->createIndex($tableName.'__priority', $tableName, 'priority');
$this->createIndex($tableName.'__value_uniq', $tableName, ['cms_site_id', 'value'], true);
$this->addCommentOnTable($tableName, 'Телефоны сайта');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
//Удаляя сайт - удаляются и все его телефоны
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m210308_120601__create_table__cms_sms_message.php | src/migrations/m210308_120601__create_table__cms_sms_message.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m210308_120601__create_table__cms_sms_message extends Migration
{
public function safeUp()
{
$tableName = 'cms_sms_message';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'user_ip' => $this->string(20),
'cms_site_id' => $this->integer()->notNull(),
'cms_sms_provider_id' => $this->integer(),
'phone' => $this->string()->notNull(),
'message' => $this->text()->notNull(),
'status' => $this->string(255)->notNull(),
'error_message' => $this->string(255),
'provider_status' => $this->string(255),
'provider_message_id' => $this->string(255),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_site_id', $tableName, 'cms_site_id');
$this->createIndex($tableName.'__status', $tableName, ['status']);
$this->createIndex($tableName.'__provider_status', $tableName, ['provider_status']);
$this->createIndex($tableName.'__provider_message_id', $tableName, ['provider_message_id']);
$this->addCommentOnTable($tableName, 'Sms сообщения');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
//Удаляя сайт - удаляются и все его телефоны
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_sms_provider_id", $tableName,
'cms_sms_provider_id', '{{%cms_sms_provider}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m250312_132302__create_table__cms_task_schedule.php | src/migrations/m250312_132302__create_table__cms_task_schedule.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m250312_132302__create_table__cms_task_schedule extends Migration
{
public function safeUp()
{
$tableName = 'cms_task_schedule';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey()->notNull(),
'created_by' => $this->integer(11),
'created_at' => $this->integer(11),
'cms_task_id' => $this->integer(11)->comment("Задача"),
'cms_user_id' => $this->integer(11)->comment("Сотрудник"),
'start_at' => $this->integer()->comment("Начало работы"),
'end_at' => $this->integer()->comment("Завершение работы"),
], $tableOptions);
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__start_at', $tableName, 'start_at');
$this->createIndex($tableName.'__end_at', $tableName, 'end_at');
$this->createIndex($tableName.'__cms_task_id', $tableName, 'cms_task_id');
$this->createIndex($tableName.'__cms_user_id', $tableName, 'cms_user_id');
$this->addCommentOnTable($tableName, 'Работа по задаче');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_task_id", $tableName,
'cms_task_id', '{{%cms_task}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_user_id", $tableName,
'cms_user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m240530_132301__create_table__cms_company cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200307_095515__alter_table__cms_content_property.php | src/migrations/m200307_095515__alter_table__cms_content_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200307_095515__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content_property}}", "is_multiple", $this->integer(1)->notNull()->defaultValue(0));
$this->update("{{%cms_content_property}}", ['is_multiple' => 1], ['multiple' => 'Y']);
$this->createIndex("is_multiple", "{{%cms_content_property}}", "is_multiple");
$this->renameColumn("{{%cms_content_property}}", "multiple", "multiple__to_del");
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m250312_132301__create_table__cms_task.php | src/migrations/m250312_132301__create_table__cms_task.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m250312_132301__create_table__cms_task extends Migration
{
public function safeUp()
{
$tableName = 'cms_task';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey()->notNull(),
'created_by' => $this->integer(11),
'created_at' => $this->integer(11),
'name' => $this->string(255)->notNull()->comment("Название"),
'description' => $this->text()->comment("Описание проекта"),
'executor_id' => $this->integer()->comment("Исполнитель"),
'cms_project_id' => $this->integer()->null()->comment("Проект"),
'cms_company_id' => $this->integer()->null()->comment("Компания"),
'cms_user_id' => $this->integer()->null()->comment("Клиент"),
'plan_start_at' => $this->integer()->null()->comment("Начало"),
'plan_end_at' => $this->integer()->null()->comment("Завершение"),
'plan_duration' => $this->integer()->null()->comment("Длительность по плану"),
'fact_duration' => $this->integer()->null()->comment("Фактическая длидельность"),
'status' => $this->string(255)->defaultValue("new")->comment("Статус"),
'executor_sort' => $this->integer(11)->null()->comment("Сортировка у исполнителя"),
'executor_end_at' => $this->integer()->comment("Ориентировочная дата исполнения задачи исполнителем"),
], $tableOptions);
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__name', $tableName, 'name');
$this->createIndex($tableName.'__executor_id', $tableName, 'executor_id');
$this->createIndex($tableName.'__cms_project_id', $tableName, 'cms_project_id');
$this->createIndex($tableName.'__cms_company_id', $tableName, 'cms_company_id');
$this->createIndex($tableName.'__cms_user_id', $tableName, 'cms_user_id');
$this->createIndex($tableName.'__executor_end_at', $tableName, 'executor_end_at');
$this->createIndex($tableName.'__executor_sort', $tableName, 'executor_sort');
$this->addCommentOnTable($tableName, 'Задачи');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__executor_id", $tableName,
'executor_id', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_user_id", $tableName,
'cms_user_id', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_project_id", $tableName,
'cms_project_id', '{{%cms_project}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_company_id", $tableName,
'cms_company_id', '{{%cms_company}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m240530_132301__create_table__cms_company cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200309_101500__alter_table__cms_user_universal_property.php | src/migrations/m200309_101500__alter_table__cms_user_universal_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200309_101500__alter_table__cms_user_universal_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_user_universal_property}}", "cms_measure_code", $this->string(20));
$this->addForeignKey(
"cms_user_universal_property__measure_code", "{{%cms_user_universal_property}}",
'cms_measure_code', '{{%cms_measure}}', 'code', 'RESTRICT', 'CASCADE'
);
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m221019_142301__update_table__cms_content_property.php | src/migrations/m221019_142301__update_table__cms_content_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m221019_142301__update_table__cms_content_property extends Migration
{
public function safeUp()
{
$tableName = "cms_content_property";
$tableExist = $this->db->getTableSchema("shop_cms_content_property", true);
if ($tableExist) {
$subQuery = $this->db->createCommand("
UPDATE
`cms_content_property` as c
INNER JOIN shop_cms_content_property as sc ON sc.cms_content_property_id = c.id
SET
c.is_vendor = sc.is_vendor
")->execute();
$subQuery = $this->db->createCommand("
UPDATE
`cms_content_property` as c
INNER JOIN shop_cms_content_property as sc ON sc.cms_content_property_id = c.id
SET
c.is_vendor_code = sc.is_vendor_code
")->execute();
$subQuery = $this->db->createCommand("
UPDATE
`cms_content_property` as c
INNER JOIN shop_cms_content_property as sc ON sc.cms_content_property_id = c.id
SET
c.is_offer_property = sc.is_offer_property
")->execute();
}
}
public function safeDown()
{
echo "m200717_132301__alter_table__shop_site cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m240223_132301__alter_table__cms_saved_filter.php | src/migrations/m240223_132301__alter_table__cms_saved_filter.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240223_132301__alter_table__cms_saved_filter extends Migration
{
public function safeUp()
{
$tableName = "cms_saved_filter";
$this->createIndex($tableName.'__uniq_tree2brand', $tableName, ['shop_brand_id', 'cms_tree_id'], true);
$this->createIndex($tableName.'__uniq_tree2country', $tableName, ['country_alpha2', 'cms_tree_id'], true);
}
public function safeDown()
{
echo "m200717_132301__alter_table__shop_site cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m240121_132301__alter_table__cms_content.php | src/migrations/m240121_132301__alter_table__cms_content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240121_132301__alter_table__cms_content extends Migration
{
public function safeUp()
{
$tableName = "cms_content";
$this->addColumn($tableName, "is_tree_only_max_level", $this->integer(1)->defaultValue(1)->notNull()->comment("Разрешено привязывать только к разделам, без подразделов"));
$this->addColumn($tableName, "is_tree_only_no_redirect", $this->integer(1)->defaultValue(1)->notNull()->comment("Разрешено привязывать только к разделам, не редирректам"));
$this->addColumn($tableName, "is_tree_required", $this->integer(1)->defaultValue(0)->notNull()->comment("Раздел необходимо выбирать обязательно"));
$this->addColumn($tableName, "is_tree_allow_change", $this->integer(1)->defaultValue(1)->notNull()->comment("Разраешено менять раздел при редактировании"));
$this->createIndex($tableName.'__is_tree_only_max_level', $tableName, 'is_tree_only_max_level');
$this->createIndex($tableName.'__is_tree_only_no_redirect', $tableName, 'is_tree_only_no_redirect');
$this->createIndex($tableName.'__is_tree_required', $tableName, 'is_tree_required');
$this->createIndex($tableName.'__is_tree_allow_change', $tableName, 'is_tree_allow_change');
}
public function safeDown()
{
echo "m200717_132301__alter_table__shop_site cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m191227_015615__alter_table__cms_tree.php | src/migrations/m191227_015615__alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m191227_015615__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_tree}}", "external_id", $this->string(255)->null());
$this->createIndex("external_id", "{{%cms_tree}}", "external_id");
}
public function safeDown()
{
echo "m191227_015615__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200309_171000__update_data__cms_user_property.php | src/migrations/m200309_171000__update_data__cms_user_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200309_171000__update_data__cms_user_property extends Migration
{
public function safeUp()
{
//Чистка данных
$tableName = "cms_user_property";
$tablePropertyName = "cms_user_universal_property";
$tablePropertyEnumName = "cms_user_universal_property_enum";
$subQuery = $this->db->createCommand("SELECT
{$tableName}.id
FROM
`{$tableName}`
LEFT JOIN {$tablePropertyName} on {$tablePropertyName}.id = {$tableName}.property_id
LEFT JOIN cms_content_element on cms_content_element.id = {$tableName}.value_enum
where
{$tablePropertyName}.property_type = 'E'
and cms_content_element.id is null")->queryAll();
$this->delete($tableName, [
'in',
'id',
$subQuery,
]);
$subQuery = $this->db->createCommand("SELECT
{$tableName}.id
FROM
`{$tableName}`
LEFT JOIN {$tablePropertyName} on {$tablePropertyName}.id = {$tableName}.property_id
LEFT JOIN {$tablePropertyEnumName} on {$tablePropertyEnumName}.id = {$tableName}.value_enum
where
{$tablePropertyName}.property_type = 'L'
AND {$tablePropertyEnumName}.id is null")->queryAll();
$this->delete($tableName, [
'in',
'id',
$subQuery,
]);
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m220127_210601__create_table__cms_user_email.php | src/migrations/m220127_210601__create_table__cms_user_email.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m220127_210601__create_table__cms_user_email extends Migration
{
public function safeUp()
{
$tableName = 'cms_user_email';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_site_id' => $this->integer()->notNull(),
'cms_user_id' => $this->integer()->notNull(),
'value' => $this->string(255)->notNull()->comment("Email"),
'name' => $this->string(255)->comment("Примечание к Email"),
'sort' => $this->integer()->notNull()->defaultValue(500),
'is_approved' => $this->integer()->notNull()->defaultValue(0)->comment("Email подтвержден?"),
'approved_key' => $this->string(255)->comment("Ключ для подтверждения Email"),
'approved_key_at' => $this->integer()->comment("Время генерация ключа"),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_site_id', $tableName, 'cms_site_id');
$this->createIndex($tableName.'__cms_user_id', $tableName, ['cms_user_id']);
$this->createIndex($tableName.'__uniq2site', $tableName, ['cms_site_id', 'value'], true);
$this->createIndex($tableName.'__uniq2user', $tableName, ['cms_user_id', 'value'], true);
$this->createIndex($tableName.'__sort', $tableName, ['sort']);
$this->addCommentOnTable($tableName, 'Email пользователей');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
//Удаляя сайт - удаляются и все сохраненные фильтры
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
//Удаляя пользователя - удаляются и все email
$this->addForeignKey(
"{$tableName}__cms_user_id", $tableName,
'cms_user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m210821_120601__create_table__cms_saved_filter.php | src/migrations/m210821_120601__create_table__cms_saved_filter.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m210821_120601__create_table__cms_saved_filter extends Migration
{
public function safeUp()
{
$tableName = 'cms_saved_filter';
$tableExist = $this->db->getTableSchema($tableName, true);
if ($tableExist) {
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($tableName, [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_site_id' => $this->integer()->notNull(),
'cms_tree_id' => $this->integer()->notNull(),
'cms_content_property_id' => $this->integer()->notNull(),
'value_content_element_id' => $this->integer(),
'value_content_property_enum_id' => $this->integer(),
'cms_image_id' => $this->integer(),
'short_name' => $this->string(255),
'code' => $this->string(255),
'description_short' => 'LONGTEXT NULL',
'description_full' => 'LONGTEXT NULL',
'meta_title' => $this->string(500),
'meta_description' => $this->text(),
'meta_keywords' => $this->text(),
'description_short_type' => $this->string(10)->defaultValue("text")->notNull(),
'description_full_type' => $this->string(10)->defaultValue("text")->notNull(),
'seo_h1' => $this->string(255),
'priority' => $this->integer()->notNull()->defaultValue(500),
], $tableOptions);
$this->createIndex($tableName.'__updated_by', $tableName, 'updated_by');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__updated_at', $tableName, 'updated_at');
$this->createIndex($tableName.'__cms_site_id', $tableName, 'cms_site_id');
$this->createIndex($tableName.'__cms_tree_id', $tableName, ['cms_tree_id']);
$this->createIndex($tableName.'__cms_image_id', $tableName, ['cms_image_id']);
$this->createIndex($tableName.'__priority', $tableName, ['priority']);
$this->createIndex($tableName.'__code2site', $tableName, ['code', 'cms_site_id']);
$this->createIndex($tableName.'__tree2element', $tableName, ['cms_tree_id', 'value_content_element_id']);
$this->createIndex($tableName.'__tree2enum', $tableName, ['cms_tree_id', 'value_content_property_enum_id']);
$this->addCommentOnTable($tableName, 'Сохраненные фильтры');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__updated_by", $tableName,
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
//Удаляя сайт - удаляются и все сохраненные фильтры
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
//Удаляя раздел - удаляются и все сохраненные фильтры
$this->addForeignKey(
"{$tableName}__cms_tree_id", $tableName,
'cms_tree_id', '{{%cms_tree}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_image_id", $tableName,
'cms_image_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_content_property_id", $tableName,
'cms_content_property_id', '{{%cms_content_property}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
"{$tableName}__value_content_element_id", $tableName,
'value_content_element_id', '{{%cms_content_element}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
"{$tableName}__value_content_property_enum_id", $tableName,
'value_content_property_enum_id', '{{%cms_content_property_enum}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function safeDown()
{
echo "m200507_110601__create_table__shop_product_relation cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m240607_182718_alter_table__cms_content_element.php | src/migrations/m240607_182718_alter_table__cms_content_element.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 15.07.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m240607_182718_alter_table__cms_content_element extends Migration
{
public function safeUp()
{
//$tableName = '{{%cms_session}}';
/*$tableName = 'cms_content_element';*/
$this->execute("ALTER TABLE `cms_content_element` CHANGE `description_short` `description_short` LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL;");
$this->execute("ALTER TABLE `cms_content_element` CHANGE `description_full` `description_full` LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL;");
}
public function safeDown()
{
/*$this->dropTable("{{%cms_content_element}}");*/
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/m200307_115515__alter_table__cms_content_property.php | src/migrations/m200307_115515__alter_table__cms_content_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m200307_115515__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$this->update("{{%cms_content_property}}", ['is_required' => 0], ['is_required' => 'N']);
$this->update("{{%cms_content_property}}", ['is_required' => 1], ['is_required' => 'Y']);
$this->alterColumn("{{%cms_content_property}}", "is_required", $this->integer(1)->notNull()->defaultValue(0));
}
public function safeDown()
{
echo "m200129_095515__alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150520_143210_cms_alter_cms_tree.php | src/migrations/v3/m150520_143210_cms_alter_cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150520_143210_cms_alter_cms_tree extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_infoblock%}} DROP `status`;");
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `status`;");
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `status_adult`;");
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `tree_ids`;");
$this->execute("ALTER TABLE {{%cms_tree%}} ADD `active` CHAR(1) NOT NULL DEFAULT 'Y' ;");
$this->execute("ALTER TABLE {{%cms_tree%}} CHANGE `seo_page_name` `code` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;");
}
public function down()
{
echo "m150520_143210_cms_alter_cms_tree cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150316_273205_alter_table__cms_user__emails_adn_phones_1.php | src/migrations/v3/m150316_273205_alter_table__cms_user__emails_adn_phones_1.php | <?php
/**
* m150122_273205_alter_table__cms_user__emails_adn_phones
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 24.02.2015
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
class m150316_273205_alter_table__cms_user__emails_adn_phones_1 extends Migration
{
public function up()
{
$this->execute("ALTER TABLE {{%cms_user%}} DROP FOREIGN KEY `cms_user_tree_cms_user_email`;");
$this->execute("ALTER TABLE {{%cms_user%}} DROP FOREIGN KEY `cms_user_tree_cms_user_phone`;");
$this->execute("ALTER TABLE {{%cms_user%}} DROP FOREIGN KEY `user_user_group_updated_by`;");
$this->addForeignKey(
'cms_user_tree_cms_user_email', "{{%cms_user}}",
'email', '{{%cms_user_email}}', 'value', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_user_tree_cms_user_phone', "{{%cms_user}}",
'phone', '{{%cms_user_phone}}', 'value', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'user_user_group_updated_by', "{{%cms_user}}",
'group_id', '{{%cms_user_group}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function down()
{
echo "m150316_273205_alter_table__cms_user__emails_adn_phones_1 cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170507_143840__alter_table__cms_component_settings.php | src/migrations/v3/m170507_143840__alter_table__cms_component_settings.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170507_143840__alter_table__cms_component_settings extends Migration
{
public function safeUp()
{
$this->dropForeignKey("cms_component_settings_site_code", "{{%cms_component_settings}}");
$this->dropForeignKey("cms_component_settings_lang_code", "{{%cms_component_settings}}");
$this->dropColumn("{{%cms_component_settings}}", "site_code");
$this->dropColumn("{{%cms_component_settings}}", "lang_code");
}
public function safeDown()
{
echo "m170507_103840__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170507_113840__alter_table__cms_tree.php | src/migrations/v3/m170507_113840__alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170507_113840__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->dropForeignKey("cms_tree_site_code", "{{%cms_tree}}");
$this->dropColumn("{{%cms_tree}}", "site_code");
}
public function safeDown()
{
echo "m170507_103840__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170507_133840__alter_table__cms_component_settings.php | src/migrations/v3/m170507_133840__alter_table__cms_component_settings.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170507_133840__alter_table__cms_component_settings extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_component_settings}}", "cms_site_id", $this->integer());
$this->createIndex('cms_site_id', "{{%cms_component_settings}}", ['cms_site_id']);
$this->addForeignKey(
'cms_component_settings__cms_site_id', "{{%cms_component_settings}}",
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
$this->db->createCommand("UPDATE cms_component_settings JOIN cms_site ON cms_site.code = cms_component_settings.site_code SET cms_component_settings.cms_site_id = cms_site.id")->execute();
}
public function safeDown()
{
echo "m170507_133840__alter_table__cms_component_settings cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150523_104025_create_table__cms_tree_property.php | src/migrations/v3/m150523_104025_create_table__cms_tree_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 10.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150523_104025_create_table__cms_tree_property extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_tree_property}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_tree_property}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'property_id' => Schema::TYPE_INTEGER . ' NULL',
'element_id' => Schema::TYPE_INTEGER . ' NULL',
'value' => Schema::TYPE_STRING . '(255) NOT NULL',
'value_enum' => Schema::TYPE_INTEGER . '(11) NULL',
'value_num' => 'decimal(18,4) NULL',
'description' => Schema::TYPE_STRING . '(255) NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_tree_property}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_tree_property}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_tree_property}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_tree_property}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_tree_property}} ADD INDEX(property_id);");
$this->execute("ALTER TABLE {{%cms_tree_property}} ADD INDEX(element_id);");
$this->execute("ALTER TABLE {{%cms_tree_property}} ADD INDEX(value);");
$this->execute("ALTER TABLE {{%cms_tree_property}} ADD INDEX(value_enum);");
$this->execute("ALTER TABLE {{%cms_tree_property}} ADD INDEX(value_num);");
$this->execute("ALTER TABLE {{%cms_tree_property}} ADD INDEX(description);");
$this->execute("ALTER TABLE {{%cms_tree_property}} COMMENT = 'Связь свойства и значения';");
$this->addForeignKey(
'cms_tree_property_created_by', "{{%cms_tree_property}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_tree_property_updated_by', "{{%cms_tree_property}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_tree_property_element_id', "{{%cms_tree_property}}",
'element_id', '{{%cms_tree}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_tree_property_property_id', "{{%cms_tree_property}}",
'property_id', '{{%cms_tree_type_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function down()
{
$this->dropForeignKey("cms_tree_property_created_by", "{{%cms_tree_property}}");
$this->dropForeignKey("cms_tree_property_updated_by", "{{%cms_tree_property}}");
$this->dropForeignKey("cms_tree_property_element_id", "{{%cms_tree_property}}");
$this->dropForeignKey("cms_tree_property_property_id", "{{%cms_tree_property}}");
$this->dropTable("{{%cms_tree_property}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150523_103525_create_table__cms_tree_type_property_enum.php | src/migrations/v3/m150523_103525_create_table__cms_tree_type_property_enum.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 10.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150523_103525_create_table__cms_tree_type_property_enum extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_tree_type_property_enum}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_tree_type_property_enum}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'property_id' => Schema::TYPE_INTEGER . ' NULL',
'value' => Schema::TYPE_STRING . '(255) NOT NULL',
'def' => "CHAR(1) NOT NULL DEFAULT 'N'",
'code' => Schema::TYPE_STRING. '(32) NOT NULL',
'priority' => Schema::TYPE_INTEGER. "(11) NOT NULL DEFAULT '500'",
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_tree_type_property_enum}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_tree_type_property_enum}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_tree_type_property_enum}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_tree_type_property_enum}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_tree_type_property_enum}} ADD INDEX(property_id);");
$this->execute("ALTER TABLE {{%cms_tree_type_property_enum}} ADD INDEX(def);");
$this->execute("ALTER TABLE {{%cms_tree_type_property_enum}} ADD INDEX(code);");
$this->execute("ALTER TABLE {{%cms_tree_type_property_enum}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_tree_type_property_enum}} ADD INDEX(value);");
$this->execute("ALTER TABLE {{%cms_tree_type_property_enum}} COMMENT = 'Справочник значений свойств для разделов';");
$this->addForeignKey(
'cms_tree_type_property_enum_created_by', "{{%cms_tree_type_property_enum}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_tree_type_property_enum_updated_by', "{{%cms_tree_type_property_enum}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_tree_type_property_enum_property_id', "{{%cms_tree_type_property_enum}}",
'property_id', '{{%cms_tree_type_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function down()
{
$this->dropForeignKey("cms_tree_type_property_enum_created_by", "{{%cms_tree_type_property_enum}}");
$this->dropForeignKey("cms_tree_type_property_enum_updated_by", "{{%cms_tree_type_property_enum}}");
$this->dropForeignKey("cms_tree_type_property_enum_property_id", "{{%cms_tree_type_property_enum}}");
$this->dropTable("{{%cms_tree_type_property_enum}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160319_093837__drop_table__cms_session.php | src/migrations/v3/m160319_093837__drop_table__cms_session.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m160319_093837__drop_table__cms_session extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_session}}", true);
if ($tableExist)
{
$this->dropTable('{{%cms_session}}');
}
}
public function safeDown()
{
echo "m150707_114030_alter_table__big_text cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m141019_100557_create_publication_table.php | src/migrations/v3/m141019_100557_create_publication_table.php | <?php
use yii\db\Schema;
use yii\db\Migration;
class m141019_100557_create_publication_table extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_publication}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_publication}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'name' => Schema::TYPE_STRING. '(255) NOT NULL',
'description_short' => Schema::TYPE_TEXT,
'description_full' => Schema::TYPE_TEXT,
'files' => Schema::TYPE_TEXT. ' NULL', //
'linked_to_model' => Schema::TYPE_STRING. '(255) NULL', //Коммент обязательно должен быть к кому то привязан
'linked_to_value' => Schema::TYPE_STRING. '(255) NULL', //Коммент обязательно должен быть к кому то привязан
'seo_page_name' => Schema::TYPE_STRING. '(64) NOT NULL', //обложка
'count_comment' => Schema::TYPE_INTEGER . ' NULL', //Количество комментариев
'count_subscribe' => Schema::TYPE_INTEGER . ' NULL', //Количество подписчиков
'users_subscribers' => Schema::TYPE_TEXT. ' NULL', //Пользователи которые подписались (их id через запятую)
'count_vote' => Schema::TYPE_INTEGER . ' NULL', //Количество голосов
'result_vote' => Schema::TYPE_INTEGER . ' NULL', //Результат голосования
'users_votes_up' => Schema::TYPE_TEXT. ' NULL', //Пользователи которые проголосовали +
'users_votes_down' => Schema::TYPE_TEXT. ' NULL', //Пользователи которые проголосовали -
'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', //статус, активна некативна, удалено
'status_adult' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0', //Возрастной статус 0 - не проверено, 1-для всех, 2-типо эротические материалы, 3-порно
'page_options' => Schema::TYPE_TEXT. ' NULL', //
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD UNIQUE(seo_page_name);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(count_comment);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(count_subscribe);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(count_vote);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(result_vote);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(linked_to_model);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(linked_to_value);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(status);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(status_adult);");
$this->execute("ALTER TABLE {{%cms_publication}} COMMENT = 'Публикация';");
$this->addForeignKey(
'publication_created_by', "{{%cms_publication}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'publication_updated_by', "{{%cms_publication}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
$this->dropForeignKey("publication_created_by", "{{%cms_publication}}");
$this->dropForeignKey("publication_updated_by", "{{%cms_publication}}");
$this->dropTable("{{%cms_publication}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150807_213220_alter_table__cms_content_property.php | src/migrations/v3/m150807_213220_alter_table__cms_content_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 30.07.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150807_213220_alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_content_property}} DROP INDEX `code`, ADD INDEX `code` (`code`) USING BTREE;");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD UNIQUE (code,content_id);");
}
public function down()
{
echo "m150807_213220_alter_table__cms_content_property cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_133515__alter_table__cms_user_property.php | src/migrations/v3/m170701_133515__alter_table__cms_user_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170701_133515__alter_table__cms_user_property extends Migration
{
public function safeUp()
{
$this->delete("{{%cms_user_property}}", [
'or',
['element_id' => null],
['property_id' => null],
]);
$this->dropForeignKey('cms_user_property_element_id', '{{%cms_user_property}}');
$this->dropForeignKey('cms_user_property_property_id', '{{%cms_user_property}}');
$this->alterColumn("{{%cms_user_property}}", 'element_id', $this->integer()->notNull());
$this->alterColumn("{{%cms_user_property}}", 'property_id', $this->integer()->notNull());
$this->addForeignKey(
'cms_user_property_element_id', "{{%cms_user_property}}",
'element_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_user_property_property_id', "{{%cms_user_property}}",
'property_id', '{{%cms_user_universal_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m170701_133515__alter_table__cms_user_property cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150607_114030_alter_table__cms_tree_and_cms_content_element.php | src/migrations/v3/m150607_114030_alter_table__cms_tree_and_cms_content_element.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150607_114030_alter_table__cms_tree_and_cms_content_element extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_tree}} ADD `description_short_type` VARCHAR(10) NOT NULL DEFAULT 'text';");
$this->execute("ALTER TABLE {{%cms_tree}} ADD `description_full_type` VARCHAR(10) NOT NULL DEFAULT 'text';");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD `description_short_type` VARCHAR(10) NOT NULL DEFAULT 'text';");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD `description_full_type` VARCHAR(10) NOT NULL DEFAULT 'text';");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(description_short_type);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(description_full_type);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(description_short_type);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(description_full_type);");
}
public function down()
{
echo "m150607_114030_alter_table__cms_tree_and_cms_content_element cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m151023_153220_alter_table__cms_content.php | src/migrations/v3/m151023_153220_alter_table__cms_content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\Json;
class m151023_153220_alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->addColumn('{{%cms_content}}', 'default_tree_id', $this->integer()); //Главный раздел по умолчанию
$this->addColumn('{{%cms_content}}', 'is_allow_change_tree', $this->string(1)->notNull()->defaultValue('Y')); //Разрешено ли менять главный раздел
$this->addColumn('{{%cms_content}}', 'root_tree_id', $this->integer()); //Корневой раздел, от него будет строится дерево с подразделами к которым можно привязывать элементы.
$this->createIndex('default_tree_id', '{{%cms_content}}', 'default_tree_id');
$this->createIndex('is_allow_change_tree', '{{%cms_content}}', 'is_allow_change_tree');
$this->createIndex('root_tree_id', '{{%cms_content}}', 'root_tree_id');
$this->addForeignKey(
'cms_content__default_tree_id', "{{%cms_content}}",
'default_tree_id', '{{%cms_tree}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content__root_tree_id', "{{%cms_content}}",
'root_tree_id', '{{%cms_tree}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m151023_153220_alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150522_193315_drop_table__cms_infoblock.php | src/migrations/v3/m150522_193315_drop_table__cms_infoblock.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 21.05.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150522_193315_drop_table__cms_infoblock extends Migration
{
public function safeUp()
{
$this->dropTable('cms_infoblock');
}
public function down()
{
echo "m150522_193315_drop_table__cms_infoblock cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150825_213220_delete_table__cms_user_group.php | src/migrations/v3/m150825_213220_delete_table__cms_user_group.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 31.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150825_213220_delete_table__cms_user_group extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE cms_user DROP FOREIGN KEY user_user_group_updated_by;");
$this->execute("ALTER TABLE `cms_user` DROP `group_id`;");
//$this->execute("ALTER TABLE cms_user_group DROP FOREIGN KEY user_group_created_by;");
//$this->execute("ALTER TABLE cms_user_group DROP FOREIGN KEY user_group_updated_by;");
$this->execute("DROP TABLE cms_user_group;");
}
public function down()
{
echo "m150825_213220_delete_table__cms_user_group cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m141205_100557_alter_table_published_behavior.php | src/migrations/v3/m141205_100557_alter_table_published_behavior.php | <?php
/**
* m141205_100557_alter_table_published_behavior
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 09.12.2014
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m141205_100557_alter_table_published_behavior
*/
class m141205_100557_alter_table_published_behavior extends Migration
{
public function up()
{
$this->addColumn('{{%cms_storage_file}}', 'published_at', Schema::TYPE_INTEGER . ' NULL');
$this->addColumn('{{%cms_publication}}', 'published_at', Schema::TYPE_INTEGER . ' NULL');
$this->addColumn('{{%cms_tree}}', 'published_at', Schema::TYPE_INTEGER . ' NULL');
$this->execute("ALTER TABLE {{%cms_storage_file}} ADD INDEX(published_at);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(published_at);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(published_at);");
}
public function down()
{
$this->dropColumn('{{%cms_storage_file}}', 'published_at');
$this->dropColumn('{{%cms_publication}}', 'published_at');
$this->dropColumn('{{%cms_tree}}', 'published_at');
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150121_273205_alter_table__cms_user__add_emails.php | src/migrations/v3/m150121_273205_alter_table__cms_user__add_emails.php | <?php
/**
* m150121_273205_alter_table__cms_user__add_emails
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 27.01.2015
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
class m150121_273205_alter_table__cms_user__add_emails extends Migration
{
public function up()
{
$this->execute("ALTER TABLE {{%cms_user}} CHANGE `email` `email` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL");
$this->execute("INSERT INTO `cms_user_email` (`id`, `user_id`, `value`, `approved`, `approved_key`, `created_at`, `updated_at`) VALUES (NULL, '1', 'admin@skeeks.com', NULL, NULL, NULL, NULL);");
//Вставляем mails в базу
/*$users = \skeeks\cms\models\User::find()->all();
if ($users)
{
foreach ($users as $user)
{
if ($user->email)
{
$userEmail = new \skeeks\cms\models\user\UserEmail([
'value' => $user->email,
'user_id' => $user->id
]);
$userEmail->save(false);
} else
{
$user->email = null;
$user->save(false);
}
}
}*/
$this->addForeignKey(
'cms_user_tree_cms_user_email', "{{%cms_user}}",
'email', '{{%cms_user_email}}', 'value', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_user_tree_cms_user_phone', "{{%cms_user}}",
'phone', '{{%cms_user_phone}}', 'value', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
echo "m150121_273205_alter_table__cms_user__add_emails cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_133355__alter_table__cms_content_element_tree.php | src/migrations/v3/m170701_133355__alter_table__cms_content_element_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170701_133355__alter_table__cms_content_element_tree extends Migration
{
public function safeUp()
{
$this->dropForeignKey("cms_content_element_tree_created_by", "{{%cms_content_element_tree}}");
$this->dropForeignKey("cms_content_element_tree_updated_by", "{{%cms_content_element_tree}}");
$this->addForeignKey(
'cms_content_element_tree__created_by', "{{%cms_content_element_tree}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element_tree__updated_by', "{{%cms_content_element_tree}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m170701_133355__alter_table__cms_content_element_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150924_193220_alter_table__cms_user_email.php | src/migrations/v3/m150924_193220_alter_table__cms_user_email.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\Json;
class m150924_193220_alter_table__cms_user_email extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE `cms_user_email` ADD `def` VARCHAR(1) NOT NULL DEFAULT 'N' AFTER `approved`;");
$this->execute("ALTER TABLE `cms_user_phone` ADD `def` VARCHAR(1) NOT NULL DEFAULT 'N' AFTER `approved`;");
}
public function safeDown()
{
echo "m150924_193220_alter_table__cms_user_email cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_133345__alter_table__cms_tree_type_property.php | src/migrations/v3/m170701_133345__alter_table__cms_tree_type_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170701_133345__alter_table__cms_tree_type_property extends Migration
{
public function safeUp()
{
$this->dropForeignKey("cms_tree_type_property_created_by", "{{%cms_tree_type_property}}");
$this->dropForeignKey("cms_tree_type_property_updated_by", "{{%cms_tree_type_property}}");
$this->addForeignKey(
'cms_tree_type_property__created_by', "{{%cms_tree_type_property}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_tree_type_property__updated_by', "{{%cms_tree_type_property}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m170701_133344__alter_table__cms_tree_property cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170514_093837__create_table__cms_content_property2content.php | src/migrations/v3/m170514_093837__create_table__cms_content_property2content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170514_093837__create_table__cms_content_property2content extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_content_property2content}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content_property2content}}", [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_content_property_id' => $this->integer()->notNull(),
'cms_content_id' => $this->integer()->notNull(),
], $tableOptions);
$this->createIndex('updated_by', '{{%cms_content_property2content}}', 'updated_by');
$this->createIndex('created_by', '{{%cms_content_property2content}}', 'created_by');
$this->createIndex('created_at', '{{%cms_content_property2content}}', 'created_at');
$this->createIndex('updated_at', '{{%cms_content_property2content}}', 'updated_at');
$this->createIndex('cms_content_property_id', '{{%cms_content_property2content}}', 'cms_content_property_id');
$this->createIndex('cms_content_id', '{{%cms_content_property2content}}', 'cms_content_id');
$this->createIndex('property2content', '{{%cms_content_property2content}}', ['cms_content_property_id', 'cms_content_id'], true);
$this->addForeignKey(
'cms_content_property2content__created_by', "{{%cms_content_property2content}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_property2content__updated_by', "{{%cms_content_property2content}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_property2content__content_id', "{{%cms_content_property2content}}",
'cms_content_id', '{{%cms_content}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_content_property2content__property_id', "{{%cms_content_property2content}}",
'cms_content_property_id', '{{%cms_content_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
$this->dropForeignKey("cms_content_property2content__created_by", "{{%cms_content_property2content}}");
$this->dropForeignKey("cms_content_property2content__updated_by", "{{%cms_content_property2content}}");
$this->dropForeignKey("cms_content_property2content__property_id", "{{%cms_content_property2content}}");
$this->dropForeignKey("cms_content_property2content__content_id", "{{%cms_content_property2content}}");
$this->dropTable("{{%cms_content_property2content}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150520_153310_cms_alter_table__cms_site.php | src/migrations/v3/m150520_153310_cms_alter_table__cms_site.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150520_153310_cms_alter_table__cms_site extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_site}}", true);
if ($tableExist)
{
$this->execute("DROP TABLE {{%cms_site%}}");
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_site}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'active' => "CHAR(1) NOT NULL DEFAULT 'Y'",
'def' => "CHAR(1) NOT NULL DEFAULT 'N'",
'priority' => Schema::TYPE_INTEGER. "(11) NOT NULL DEFAULT '500'",
'code' => "CHAR(5) NOT NULL",
'lang_code' => "CHAR(5) NOT NULL",
'name' => Schema::TYPE_STRING . '(255) NOT NULL',
'server_name' => Schema::TYPE_STRING . '(255) NULL',
'description' => Schema::TYPE_STRING . '(255) NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_site}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_site}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_site}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_site}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_site}} ADD INDEX(active);");
$this->execute("ALTER TABLE {{%cms_site}} ADD INDEX(server_name);");
$this->execute("ALTER TABLE {{%cms_site}} ADD INDEX(def);");
$this->execute("ALTER TABLE {{%cms_site}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_site}} ADD INDEX(lang_code);");
$this->execute("ALTER TABLE {{%cms_site}} ADD UNIQUE(code);");
$this->execute("ALTER TABLE {{%cms_site}} COMMENT = 'Сайты';");
$this->addForeignKey(
'cms_site_created_by', "{{%cms_site}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_site_updated_by', "{{%cms_site}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_site_lang_code', "{{%cms_site}}",
'lang_code', '{{%cms_lang}}', 'code', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
echo "m150520_153310_cms_alter_table__cms_site cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150512_103220_create_table__cms_content.php | src/migrations/v3/m150512_103220_create_table__cms_content.php | <?php
/**
* m150121_273200_create_table__cms_content
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 27.01.2015
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m150512_103210_create_table__cms_content
*/
class m150512_103220_create_table__cms_content extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_content}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'name' => Schema::TYPE_STRING. '(255) NOT NULL',
'code' => Schema::TYPE_STRING. '(50) NOT NULL',
'active' => "CHAR(1) NOT NULL DEFAULT 'Y'",
'priority' => Schema::TYPE_INTEGER. "(11) NOT NULL DEFAULT '500'",
'description' => Schema::TYPE_TEXT. " NULL",
'files' => Schema::TYPE_TEXT. ' NULL',
'index_for_search' => "CHAR(1) NOT NULL DEFAULT 'Y'", //Индексировать элементы для модуля поиска
'name_meny' => Schema::TYPE_STRING. '(100) NULL',
'name_one' => Schema::TYPE_STRING. '(100) NULL',
'tree_chooser' => "CHAR(1) NULL", //Интерфейс привязки элемента к разделам
'list_mode' => "CHAR(1) NULL", //Режим просмотра разделов и элементов
'content_type' => Schema::TYPE_STRING. '(32) NOT NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(active);");
$this->execute("ALTER TABLE {{%cms_content}} ADD UNIQUE(code);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(index_for_search);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(name_meny);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(name_one);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(tree_chooser);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(list_mode);");
$this->execute("ALTER TABLE {{%cms_content}} ADD INDEX(content_type);");
$this->addForeignKey(
'cms_content_created_by', "{{%cms_content}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_updated_by', "{{%cms_content}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_cms_content_type', "{{%cms_content}}",
'content_type', '{{%cms_content_type}}', 'code', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
$this->dropForeignKey("cms_content_created_by", "{{%cms_content}}");
$this->dropForeignKey("cms_content_updated_by", "{{%cms_content}}");
$this->dropForeignKey("cms_content_cms_content_type", "{{%cms_content}}");
$this->dropTable("{{%cms_content}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150519_113210_cms_alter_clear_social_data.php | src/migrations/v3/m150519_113210_cms_alter_clear_social_data.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150519_113210_cms_alter_clear_social_data extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `count_comment`;");
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `count_subscribe`;");
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `users_subscribers`;");
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `count_vote`;");
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `result_vote`;");
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `users_votes_up`;");
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `users_votes_down`;");
$this->execute("ALTER TABLE {{%cms_publication%}} DROP `count_comment`;");
$this->execute("ALTER TABLE {{%cms_publication%}} DROP `count_subscribe`;");
$this->execute("ALTER TABLE {{%cms_publication%}} DROP `users_subscribers`;");
$this->execute("ALTER TABLE {{%cms_publication%}} DROP `count_vote`;");
$this->execute("ALTER TABLE {{%cms_publication%}} DROP `result_vote`;");
$this->execute("ALTER TABLE {{%cms_publication%}} DROP `users_votes_up`;");
$this->execute("ALTER TABLE {{%cms_publication%}} DROP `users_votes_down`;");
}
public function down()
{
echo "m150519_113210_cms_alter_clear_social_data cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150520_153210_cms_alter_meta_data.php | src/migrations/v3/m150520_153210_cms_alter_meta_data.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150520_153210_cms_alter_meta_data extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_tree%}} ADD `meta_title` VARCHAR(500) NULL , ADD INDEX (`meta_title`) ;");
$this->execute("ALTER TABLE {{%cms_tree%}} ADD `meta_description` TEXT NULL ;");
$this->execute("ALTER TABLE {{%cms_tree%}} ADD `meta_keywords` TEXT NULL ;");
$this->execute("ALTER TABLE {{%cms_content_element%}} ADD `meta_title` VARCHAR(500) NOT NULL , ADD INDEX (`meta_title`) ;");
$this->execute("ALTER TABLE {{%cms_content_element%}} ADD `meta_description` TEXT NULL ;");
$this->execute("ALTER TABLE {{%cms_content_element%}} ADD `meta_keywords` TEXT NULL ;");
}
public function down()
{
echo "m150520_153210_cms_alter_meta_data cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160320_093837__alter_table__cms_storage_file.php | src/migrations/v3/m160320_093837__alter_table__cms_storage_file.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m160320_093837__alter_table__cms_storage_file extends Migration
{
public function safeUp()
{
//m220319_093837__alter_table__cms_storage_file
if ($this->db->createCommand('SELECT * FROM migration WHERE version="m220319_093837__alter_table__cms_storage_file"')->queryOne())
{
$this->db->createCommand()->delete('migration', 'version = "m220319_093837__alter_table__cms_storage_file"')->execute();
return true;
}
$this->dropForeignKey('storage_file_created_by', "{{%cms_storage_file}}");
$this->dropForeignKey('storage_file_updated_by', "{{%cms_storage_file}}");
$this->addForeignKey(
'storage_file_created_by', "{{%cms_storage_file}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'storage_file_updated_by', "{{%cms_storage_file}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
$this->dropForeignKey('storage_file_created_by', "{{%cms_storage_file}}");
$this->dropForeignKey('storage_file_updated_by', "{{%cms_storage_file}}");
$this->addForeignKey(
'storage_file_created_by', "{{%cms_storage_file}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'storage_file_updated_by', "{{%cms_storage_file}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160315_093837__create_table__cms_user2cms_content_elements.php | src/migrations/v3/m160315_093837__create_table__cms_user2cms_content_elements.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m160315_093837__create_table__cms_user2cms_content_elements extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_content_element2cms_user}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content_element2cms_user}}", [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_user_id' => $this->integer()->notNull(),
'cms_content_element_id'=> $this->integer()->notNull(),
], $tableOptions);
$this->createIndex('updated_by', '{{%cms_content_element2cms_user}}', 'updated_by');
$this->createIndex('created_by', '{{%cms_content_element2cms_user}}', 'created_by');
$this->createIndex('created_at', '{{%cms_content_element2cms_user}}', 'created_at');
$this->createIndex('updated_at', '{{%cms_content_element2cms_user}}', 'updated_at');
$this->createIndex('user2elements', '{{%cms_content_element2cms_user}}', ['cms_user_id', 'cms_content_element_id'], true);
$this->execute("ALTER TABLE {{%cms_content_element2cms_user}} COMMENT = 'Favorites content items';");
$this->addForeignKey(
'cms_content_element2cms_user__created_by', "{{%cms_content_element2cms_user}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element2cms_user__updated_by', "{{%cms_content_element2cms_user}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element2cms_user__cms_user_id', "{{%cms_content_element2cms_user}}",
'cms_user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_content_element2cms_user__cms_content_element_id', "{{%cms_content_element2cms_user}}",
'cms_content_element_id', '{{%cms_content_element}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
$this->dropForeignKey("cms_content_element2cms_user_updated_by", "{{%cms_content_element2cms_user}}");
$this->dropForeignKey("cms_content_element2cms_user_updated_by", "{{%cms_content_element2cms_user}}");
$this->dropForeignKey("cms_content_element2cms_user__cms_user_id", "{{%cms_content_element2cms_user}}");
$this->dropForeignKey("cms_content_element2cms_user__cms_content_element_id", "{{%cms_content_element2cms_user}}");
$this->dropTable("{{%cms_content_element2cms_user}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_133344__alter_table__cms_tree_property.php | src/migrations/v3/m170701_133344__alter_table__cms_tree_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170701_133344__alter_table__cms_tree_property extends Migration
{
public function safeUp()
{
$this->dropForeignKey("cms_tree_property_created_by", "{{%cms_tree_property}}");
$this->dropForeignKey("cms_tree_property_updated_by", "{{%cms_tree_property}}");
$this->addForeignKey(
'cms_tree_property__created_by', "{{%cms_tree_property}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_tree_property__updated_by', "{{%cms_tree_property}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m170701_133344__alter_table__cms_tree_property cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m141104_100557_create_cms_tree_table.php | src/migrations/v3/m141104_100557_create_cms_tree_table.php | <?php
use yii\db\Schema;
use yii\db\Migration;
class m141104_100557_create_cms_tree_table extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_tree}}", true);
if ($tableExist)
{
$this->dropTable("{{%cms_tree}}");
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_tree}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'name' => Schema::TYPE_STRING. '(255) NOT NULL',
'description_short' => Schema::TYPE_TEXT,
'description_full' => Schema::TYPE_TEXT,
'files' => Schema::TYPE_TEXT. ' NULL', //
'page_options' => Schema::TYPE_TEXT. ' NULL', //
'seo_page_name' => Schema::TYPE_STRING. '(64) NULL', //обложка
'count_comment' => Schema::TYPE_INTEGER . ' NULL', //Количество комментариев
'count_subscribe' => Schema::TYPE_INTEGER . ' NULL', //Количество подписчиков
'users_subscribers' => Schema::TYPE_TEXT. ' NULL', //Пользователи которые подписались (их id через запятую)
'count_vote' => Schema::TYPE_INTEGER . ' NULL', //Количество голосов
'result_vote' => Schema::TYPE_INTEGER . ' NULL', //Результат голосования
'users_votes_up' => Schema::TYPE_TEXT. ' NULL', //Пользователи которые проголосовали +
'users_votes_down' => Schema::TYPE_TEXT. ' NULL', //Пользователи которые проголосовали -
'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', //статус, активна некативна, удалено
'status_adult' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0', //Возрастной статус 0 - не проверено, 1-для всех, 2-типо эротические материалы, 3-порно
'pid' => Schema::TYPE_INTEGER . ' NULL',
'pid_main' => Schema::TYPE_INTEGER . ' NULL',
'pids' => Schema::TYPE_STRING . '(255) NULL',
'level' => Schema::TYPE_INTEGER . ' DEFAULT 0',
'dir' => Schema::TYPE_TEXT . ' NULL',
'has_children' => Schema::TYPE_SMALLINT . '(1) DEFAULT 0',
'main_root' => Schema::TYPE_SMALLINT . ' NULL',
'priority' => Schema::TYPE_INTEGER . ' NOT NULL DEFAULT 0',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(seo_page_name);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(count_comment);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(count_subscribe);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(count_vote);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(result_vote);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(status);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(status_adult);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(pid);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(pid_main);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(pids);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(level);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(has_children);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD UNIQUE(pid, seo_page_name);");
//$this->execute("ALTER TABLE {{%cms_tree}} ADD UNIQUE(pid_main, dir);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD UNIQUE(main_root);");
$this->execute("ALTER TABLE {{%cms_tree}} COMMENT = 'Страницы дерево';");
$this->addForeignKey(
'cms_tree_pid_cms_tree', "{{%cms_tree}}",
'pid', '{{%cms_tree}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'pid_main_pid_cms_tree', "{{%cms_tree}}",
'pid_main', '{{%cms_tree}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_tree_created_by', "{{%cms_tree}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_tree_updated_by', "{{%cms_tree}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
$this->dropForeignKey("pid_main_pid_cms_tree", "{{%cms_tree}}");
$this->dropForeignKey("cms_tree_pid_cms_tree", "{{%cms_tree}}");
$this->dropForeignKey("cms_tree_created_by", "{{%cms_tree}}");
$this->dropForeignKey("cms_tree_updated_by", "{{%cms_tree}}");
$this->dropTable("{{%cms_tree}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m141231_100559_alter_table_tree.php | src/migrations/v3/m141231_100559_alter_table_tree.php | <?php
/**
* m141231_100559_alter_table_tree
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 31.12.2014
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
class m141231_100559_alter_table_tree extends Migration
{
public function up()
{
$this->addColumn('{{%cms_tree}}', 'redirect', Schema::TYPE_STRING . '(500) NULL');
$this->addColumn('{{%cms_tree}}', 'tree_ids', Schema::TYPE_STRING . '(500) NULL');
$this->addColumn('{{%cms_tree}}', 'tree_menu_ids', Schema::TYPE_STRING . '(500) NULL');
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(redirect);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(tree_ids);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(tree_menu_ids);");
}
public function down()
{
$this->dropColumn('{{%cms_tree}}', 'tree_ids');
$this->dropColumn('{{%cms_tree}}', 'tree_menu_ids');
$this->dropColumn('{{%cms_tree}}', 'redirect');
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150512_123230_create_table__cms_content_property_enum.php | src/migrations/v3/m150512_123230_create_table__cms_content_property_enum.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 10.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150512_123230_create_table__cms_content_property_enum extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_content_property_enum}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content_property_enum}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'property_id' => Schema::TYPE_INTEGER . ' NULL',
'value' => Schema::TYPE_STRING . '(255) NOT NULL',
'def' => "CHAR(1) NOT NULL DEFAULT 'N'",
'code' => Schema::TYPE_STRING. '(32) NOT NULL',
'priority' => Schema::TYPE_INTEGER. "(11) NOT NULL DEFAULT '500'",
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_content_property_enum}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_content_property_enum}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_content_property_enum}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_content_property_enum}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_content_property_enum}} ADD INDEX(property_id);");
$this->execute("ALTER TABLE {{%cms_content_property_enum}} ADD INDEX(def);");
$this->execute("ALTER TABLE {{%cms_content_property_enum}} ADD INDEX(code);");
$this->execute("ALTER TABLE {{%cms_content_property_enum}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_content_property_enum}} ADD INDEX(value);");
$this->execute("ALTER TABLE {{%cms_content_property_enum}} COMMENT = 'Справочник значений свойств типа список';");
$this->addForeignKey(
'cms_content_property_enum_created_by', "{{%cms_content_property_enum}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_content_property_enum_updated_by', "{{%cms_content_property_enum}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_content_property_enum_property_id', "{{%cms_content_property_enum}}",
'property_id', '{{%cms_content_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function down()
{
$this->dropForeignKey("cms_content_property_enum_created_by", "{{%cms_content_property_enum}}");
$this->dropForeignKey("cms_content_property_enum_updated_by", "{{%cms_content_property_enum}}");
$this->dropForeignKey("cms_content_property_enum_property_id", "{{%cms_content_property_enum}}");
$this->dropTable("{{%cms_content_property_enum}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.