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/m220127_200601__delete_tables__user_email_and_phone.php | src/migrations/m220127_200601__delete_tables__user_email_and_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 m220127_200601__delete_tables__user_email_and_phone extends Migration
{
public function safeUp()
{
$this->dropTable("cms_user_email");
$this->dropTable("cms_user_phone");
}
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/m200410_121000__alter_table__cms_tree.php | src/migrations/m200410_121000__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\Migration;
class m200410_121000__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$tableName = "cms_tree";
$this->createIndex("cms_tree_external_id_unique", $tableName, ["cms_site_id", "external_id"], true);
}
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/m200309_161000__update_data__cms_tree_property.php | src/migrations/m200309_161000__update_data__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_161000__update_data__cms_tree_property extends Migration
{
public function safeUp()
{
//Чистка данных
$tableName = "cms_tree_property";
$subQuery = $this->db->createCommand("SELECT
{$tableName}.id
FROM
`{$tableName}`
LEFT JOIN cms_tree_type_property on cms_tree_type_property.id = {$tableName}.property_id
LEFT JOIN cms_content_element on cms_content_element.id = {$tableName}.value_enum
where
cms_tree_type_property.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 cms_tree_type_property on cms_tree_type_property.id = {$tableName}.property_id
LEFT JOIN cms_tree_type_property_enum on cms_tree_type_property_enum.id = {$tableName}.value_enum
where
cms_tree_type_property.property_type = 'L'
AND cms_tree_type_property_enum.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/m240729_132301__create_table__cms_department.php | src/migrations/m240729_132301__create_table__cms_department.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240729_132301__create_table__cms_department extends Migration
{
public function safeUp()
{
$tableName = 'cms_department';
$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("Название"),
'pid' => $this->integer()->null()->comment("Родительский отдел"),
'worker_id' => $this->integer()->null()->comment("Руководитель отдела"),
'sort' => $this->integer()->notNull()->defaultValue(100),
], $tableOptions);
$this->createIndex($tableName.'__worker_id', $tableName, 'worker_id');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__sort', $tableName, 'sort');
$this->createIndex($tableName.'__pid', $tableName, 'pid');
$this->addCommentOnTable($tableName, 'Отделы компании');
$this->addForeignKey(
"{$tableName}__worker_id", $tableName,
'worker_id', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__pid", $tableName,
'pid', '{{%cms_department}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
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_153000__update_data__cms_content_element_property.php | src/migrations/m200309_153000__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_153000__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_element on cms_content_element.id = cms_content_element_property.value_enum
WHERE
cms_content_property.property_type = 'E' AND
cms_content_element.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_element_id` = p.value_enum
WHERE
cms_content_property.property_type = 'E'
")->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_element on cms_content_element.id = {$tableName}.value_enum
where
cms_content_property.property_type = 'E'")->queryAll();
$this->update("{$tableName}", [
'value_element_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/m240821_162301__alter_table__cms_company.php | src/migrations/m240821_162301__alter_table__cms_company.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 m240821_162301__alter_table__cms_company extends Migration
{
public function safeUp()
{
//$tableName = '{{%cms_session}}';
$tableName = 'cms_company';
$this->addColumn($tableName, "cms_company_status_id", $this->integer()->null()->comment("Статус компании"));
$this->createIndex($tableName.'__cms_company_status_id', $tableName, 'cms_company_status_id');
$this->addForeignKey(
"{$tableName}__cms_company_status_id", $tableName,
'cms_company_status_id', '{{%cms_company_status}}', 'id', 'SET NULL', 'SET 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/m190412_175515__alter_table__cms_lang.php | src/migrations/m190412_175515__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_175515__alter_table__cms_lang extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_lang}}", "is_default", $this->integer(1)->notNull()->defaultValue(0));
$this->createIndex("is_default", "{{%cms_lang}}", "is_default");
}
public function safeDown()
{
echo "m190412_175515__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/m220812_120601__alter_table__cms_content_property_enum.php | src/migrations/m220812_120601__alter_table__cms_content_property_enum.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m220812_120601__alter_table__cms_content_property_enum extends Migration
{
public function safeUp()
{
$tableName = "cms_content_property_enum";
$this->addColumn($tableName, "value_for_saved_filter", $this->string(255)->comment("Название (для сохраненных фильтров)"));
$this->addColumn($tableName, "description", $this->text()->comment("Описание"));
$this->addColumn($tableName, "cms_image_id", $this->integer()->comment("Фото/Изображение"));
$this->createIndex($tableName.'__value_for_saved_filter', $tableName, 'value_for_saved_filter');
$this->createIndex($tableName.'__cms_image_id', $tableName, 'cms_image_id');
$this->addForeignKey(
"{$tableName}__cms_image_id", $tableName,
'cms_image_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
}
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/m200307_105515__alter_table__cms_content_property.php | src/migrations/m200307_105515__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_105515__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content_property}}", "is_active", $this->integer(1)->notNull()->defaultValue(1));
$this->update("{{%cms_content_property}}", ['is_active' => 0], ['active' => 'N']);
$this->createIndex("is_active", "{{%cms_content_property}}", "is_active");
$this->renameColumn("{{%cms_content_property}}", "active", "active__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/m200716_160601__create_table__cms_site_social.php | src/migrations/m200716_160601__create_table__cms_site_social.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_160601__create_table__cms_site_social extends Migration
{
public function safeUp()
{
$tableName = 'cms_site_social';
$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(),
'social_type' => $this->string(255)->notNull(),
'url' => $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.'__social_type', $tableName, 'social_type');
$this->createIndex($tableName.'__url_uniq', $tableName, ['cms_site_id', 'url'], 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/m201127_121000__alter_table__cms_content_element.php | src/migrations/m201127_121000__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 m201127_121000__alter_table__cms_content_element extends Migration
{
public function safeUp()
{
$tableName = 'cms_content_element';
$this->addColumn($tableName, "main_cce_id", $this->integer()->comment("Элемент берет информацию с другого элемента"));
$this->createIndex("main_cce_id", $tableName, ['main_cce_id']);
$this->addForeignKey(
"{$tableName}__main_cce_id", $tableName,
'main_cce_id', $tableName, 'id', 'SET NULL', 'SET NULL'
);
$this->addColumn($tableName, "main_cce_at", $this->integer()->comment("Когда создана привязка"));
$this->addColumn($tableName, "main_cce_by", $this->integer(1)->comment("Кем создана привязка"));
$this->createIndex("main_cce_at", $tableName, ["main_cce_at"]);
$this->createIndex("main_cce_by", $tableName, ["main_cce_by"]);
$this->addForeignKey(
"{$tableName}__main_cce_by", $tableName,
'main_cce_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
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/m240804_122301__create_table__cms_deal_type.php | src/migrations/m240804_122301__create_table__cms_deal_type.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240804_122301__create_table__cms_deal_type extends Migration
{
public function safeUp()
{
$tableName = 'cms_deal_type';
$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()->notNull(),
'description' => $this->text()->null(),
'is_periodic' => $this->integer(1)->notNull()->defaultValue(0),
'period' => $this->string(10)->null(),
], $tableOptions);
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__name', $tableName, 'name');
$this->createIndex($tableName.'__is_periodic', $tableName, 'is_periodic');
$this->createIndex($tableName.'__period', $tableName, 'period');
$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/m240302_132301__alter_tables__add_sx_id.php | src/migrations/m240302_132301__alter_tables__add_sx_id.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240302_132301__alter_tables__add_sx_id extends Migration
{
public function safeUp()
{
$this->addColumn("cms_content_element", "sx_id", $this->integer()->null());
$this->createIndex('cms_content_element__sx_id', "cms_content_element", ['sx_id'], true);
$this->addColumn("cms_tree", "sx_id", $this->integer()->null());
$this->createIndex('cms_tree__sx_id', "cms_tree", ['sx_id'], true);
$this->addColumn("cms_content_property", "sx_id", $this->integer()->null());
$this->createIndex('cms_content_property__sx_id', "cms_content_property", ['sx_id'], true);
$this->addColumn("cms_content_property_enum", "sx_id", $this->integer()->null());
$this->createIndex('cms_content_property_enum__sx_id', "cms_content_property_enum", ['sx_id'], true);
$this->addColumn("cms_storage_file", "sx_id", $this->integer()->null());
$this->createIndex('cms_storage_file__sx_id', "cms_storage_file", ['sx_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/m240122_132301__create_table__cms_country.php | src/migrations/m240122_132301__create_table__cms_country.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240122_132301__create_table__cms_country extends Migration
{
public function safeUp()
{
$tableName = 'cms_country';
$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(),
'name' => $this->string(255)->notNull()->unique()->comment("Название страны"),
'alpha2' => $this->string(2)->notNull()->unique()->comment("ISO 3166-1 alpha-2"),
'alpha3' => $this->string(3)->notNull()->unique()->comment("ISO 3166-1 alpha-3"),
'iso' => $this->string(3)->notNull()->unique()->comment("Цифровой код"),
'phone_code' => $this->string(16)->null()->comment("Код телефона"),
'domain' => $this->string(16)->null()->comment("Домен"),
'flag_image_id' => $this->integer()->null()->comment("Флаг"),
], $tableOptions);
$this->createIndex($tableName.'__phone_code', $tableName, 'phone_code');
$this->createIndex($tableName.'__domain', $tableName, 'domain');
$this->createIndex($tableName.'__flag_image_id', $tableName, 'flag_image_id');
$this->addCommentOnTable($tableName, 'Справочник стран');
$this->addForeignKey(
"{$tableName}__flag_image_id", $tableName,
'flag_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/m200309_163000__update_data__cms_tree_property.php | src/migrations/m200309_163000__update_data__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_163000__update_data__cms_tree_property extends Migration
{
public function safeUp()
{
$tableName = 'cms_tree_property';
$subQuery = $this->db->createCommand("SELECT
{$tableName}.id
FROM
`{$tableName}`
LEFT JOIN cms_tree_type_property on cms_tree_type_property.id = {$tableName}.property_id
LEFT JOIN cms_content_element on cms_content_element.id = {$tableName}.value_enum
where
cms_tree_type_property.property_type = 'E'")->queryAll();
$this->update("{$tableName}", [
'value_element_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/m210802_121000__alter_table__cms_content_property.php | src/migrations/m210802_121000__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\Schema;
use yii\db\Migration;
class m210802_121000__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$tableName = 'cms_content_property';
$this->db->createCommand("UPDATE
`cms_content_property` as ccp
LEFT JOIN (
SELECT cs.id
FROM cms_site as cs
WHERE cs.is_default = 1
) site ON 1 = 1
SET
ccp.`cms_site_id` = site.id
WHERE
ccp.`cms_site_id` IS NULL
")->execute();
$this->dropIndex("code_2", $tableName);
$this->createIndex($tableName.'__code2site', $tableName, ['code', '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_090601__create_table__cms_site_address.php | src/migrations/m200720_090601__create_table__cms_site_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 m200720_090601__create_table__cms_site_address extends Migration
{
public function safeUp()
{
$tableName = 'cms_site_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_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("Долгота"),
'work_time' => $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_site_id', 'value'], true);
$this->createIndex($tableName.'__coordinates', $tableName, ['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'
);
$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/m220603_100601__alter_table__cms_user.php | src/migrations/m220603_100601__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 m220603_100601__alter_table__cms_user extends Migration
{
public function safeUp()
{
$tableName = "cms_user";
$this->addColumn($tableName, "is_company", $this->integer(1)->defaultValue(0)->comment("Аккаунт компании?"));
$this->addColumn($tableName, "company_name", $this->string(255)->comment("Название компании"));
$this->createIndex("is_company", $tableName, ['is_company']);
$this->createIndex("company_name", $tableName, ['company_name']);
}
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/m190412_215515__update_data_table__cms_lang.php | src/migrations/m190412_215515__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_215515__update_data_table__cms_lang extends Migration
{
public function safeUp()
{
$this->update("{{%cms_lang}}", ['is_active' => 1], ['active' => '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/m190920_015515__update_data_table__cms_user_email.php | src/migrations/m190920_015515__update_data_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 m190920_015515__update_data_table__cms_user_email extends Migration
{
public function safeUp()
{
$this->delete("{{%cms_user_email}}", ['user_id' => null]);
}
public function safeDown()
{
echo "m190920_015515__update_data_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/m210702_121000__alter_table__cms_storage_file.php | src/migrations/m210702_121000__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 m210702_121000__alter_table__cms_storage_file extends Migration
{
public function safeUp()
{
$tableName = 'cms_storage_file';
$this->alterColumn($tableName, "mime_type", $this->string(32));
}
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/m240804_132301__create_table__cms_deal.php | src/migrations/m240804_132301__create_table__cms_deal.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240804_132301__create_table__cms_deal extends Migration
{
public function safeUp()
{
$tableName = 'cms_deal';
$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(),
'start_at' => $this->integer()->notNull()->comment("Начало сделки"),
'end_at' => $this->integer()->null()->comment("Дата завершения сделки"),
'cms_deal_type_id' => $this->integer()->notNull()->comment("Тип сделки"),
'cms_company_id' => $this->integer()->null()->comment("Связь с компанией"),
'cms_user_id' => $this->integer()->null()->comment("Связь с пользователем"),
'name' => $this->string(255)->notNull()->comment("Название"),
'description' => $this->text()->notNull()->comment("Описание"),
'amount' => $this->decimal(19,4)->notNull()->defaultValue(0.0000)->comment("Значение цены"),
'currency_code' => $this->string(3)->notNull()->defaultValue('RUB')->comment("Валюта"),
'is_periodic' => $this->boolean()->unsigned()->notNull()->comment("Периодическая или разовая сделка?"),
'period' => $this->string(10)->null()->comment("Период действия для периодического сделки"),
'is_active' => $this->boolean()->notNull()->defaultValue(1)->comment("Активность"),
'is_auto' => $this->boolean()->notNull()->defaultValue(1)->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.'__is_active', $tableName, 'is_active');
$this->createIndex($tableName.'__is_periodic', $tableName, 'is_periodic');
$this->createIndex($tableName.'__is_auto', $tableName, 'is_auto');
$this->createIndex($tableName.'__amount', $tableName, 'amount');
$this->createIndex($tableName.'__currency_code', $tableName, 'currency_code');
$this->createIndex($tableName.'__name', $tableName, 'name');
$this->createIndex($tableName.'__cms_company_id', $tableName, 'cms_company_id');
$this->createIndex($tableName.'__cms_user_id', $tableName, 'cms_user_id');
$this->createIndex($tableName.'__cms_deal_type_id', $tableName, 'cms_deal_type_id');
$this->addCommentOnTable($tableName, 'Сделки');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__currency_code", $tableName,
'currency_code', '{{%money_currency}}', 'code', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
"{$tableName}__cms_company_id", $tableName,
'cms_company_id', '{{%cms_company}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
"{$tableName}__cms_user_id", $tableName,
'cms_user_id', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
"{$tableName}__cms_deal_type_id", $tableName,
'cms_deal_type_id', '{{%cms_deal_type}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
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/m240717_172301__create_table__cms_company2contractor.php | src/migrations/m240717_172301__create_table__cms_company2contractor.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_172301__create_table__cms_company2contractor extends Migration
{
public function safeUp()
{
$tableName = 'cms_company2contractor';
$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_company_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.'__uniq', $tableName, ['cms_contractor_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_contractor_id", $tableName,
'cms_contractor_id', '{{%cms_contractor}}', '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/m240821_142301__create_table__cms_company_category.php | src/migrations/m240821_142301__create_table__cms_company_category.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240821_142301__create_table__cms_company_category extends Migration
{
public function safeUp()
{
$tableName = 'cms_company_category';
$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(),
'sort' => $this->integer()->defaultValue(100)->notNull(),
], $tableOptions);
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__sort', $tableName, 'sort');
$this->createIndex($tableName.'__name', $tableName, ['name'], true);
$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/m200129_085515__alter_table__cms_content.php | src/migrations/m200129_085515__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_085515__alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content}}", "is_visible", $this->integer(1)->notNull()->defaultValue(1));
$this->update("{{%cms_content}}", ['is_visible' => 1], ['visible' => 'Y']);
$this->update("{{%cms_content}}", ['is_visible' => 0], ['visible' => 'N']);
$this->dropColumn("{{%cms_content}}", "visible");
}
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/m230809_132301__alter_table__cms_content_property.php | src/migrations/m230809_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 m230809_132301__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$tableName = "cms_content_property";
$this->addColumn($tableName, "is_img_offer_property", $this->integer(1)->defaultValue(0)->notNull());
$this->createIndex($tableName.'__is_img_offer_property', $tableName, 'is_img_offer_property');
}
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/m200307_181000__alter_table__cms_content_property.php | src/migrations/m200307_181000__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_181000__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content_property}}", "cms_measure_code", $this->string(20));
$this->addForeignKey(
"cms_content_property__measure_code", "{{%cms_content_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/m200129_035515__alter_table__cms_content.php | src/migrations/m200129_035515__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_035515__alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content}}", "is_active", $this->integer(1)->notNull()->defaultValue(1));
$this->createIndex("is_active", "{{%cms_content}}", "is_active");
}
public function safeDown()
{
echo "m200129_035515__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/m210308_110601__create_table__cms_sms_provider.php | src/migrations/m210308_110601__create_table__cms_sms_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 m210308_110601__create_table__cms_sms_provider extends Migration
{
public function safeUp()
{
$tableName = 'cms_sms_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, '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'
);
}
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_172301__create_table__cms_faq2content_element.php | src/migrations/m251022_172301__create_table__cms_faq2content_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 m251022_172301__create_table__cms_faq2content_element extends Migration
{
public function safeUp()
{
$tableName = 'cms_faq2content_element';
$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(),
'cms_faq_id' => $this->integer()->notNull()->comment("Faq"),
'cms_content_element_id' => $this->integer()->notNull()->comment("Элемент"),
], $tableOptions);
$this->createIndex($tableName.'__uniq', $tableName, ['cms_faq_id', 'cms_content_element_id'], true);
$this->addCommentOnTable($tableName, 'Связь вопрос/ответ с элементом');
$this->addForeignKey(
"{$tableName}__cms_faq_id", $tableName,
'cms_faq_id', '{{%cms_faq}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_content_element_id", $tableName,
'cms_content_element_id', '{{%cms_content_element}}', '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/m200309_181000__drop_to_del_columns.php | src/migrations/m200309_181000__drop_to_del_columns.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_181000__drop_to_del_columns extends Migration
{
public function safeUp()
{
$this->dropColumn("cms_tree_type_property", "active__to_del");
$this->dropColumn("cms_tree_type_property", "multiple__to_del");
$this->dropColumn("cms_content_property", "active__to_del");
$this->dropColumn("cms_content_property", "multiple__to_del");
$this->dropColumn("cms_user_universal_property", "active__to_del");
$this->dropColumn("cms_user_universal_property", "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/m240811_132301__create_table__cms_deal2bill.php | src/migrations/m240811_132301__create_table__cms_deal2bill.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240811_132301__create_table__cms_deal2bill extends Migration
{
public function safeUp()
{
$tableName = 'cms_deal2bill';
$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(),
'cms_deal_id' => $this->integer()->notNull()->comment("Сделка"),
'shop_bill_id' => $this->integer()->notNull()->comment("Счет"),
], $tableOptions);
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__unique', $tableName, ['cms_deal_id', 'shop_bill_id'], true);
$this->addCommentOnTable($tableName, 'Связь сделок со счетами');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_deal_id", $tableName,
'cms_deal_id', '{{%cms_deal}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__shop_bill_id", $tableName,
'shop_bill_id', '{{%shop_bill}}', '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/m250125_152301__create_table__cms_log.php | src/migrations/m250125_152301__create_table__cms_log.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m250125_152301__create_table__cms_log extends Migration
{
public function safeUp()
{
$tableName = 'cms_log';
$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_company_id' => $this->integer()->null(),
'cms_user_id' => $this->integer()->null(),
'log_type' => $this->string(255)->notNull()->defaultValue("comment"),
'comment' => $this->text()->null(),
'model_code' => $this->string(255)->null(),
'model_id' => $this->integer()->null(),
'model_as_text' => $this->string(255)->null(),
'data' => "LONGTEXT NULL",
'sub_model_code' => $this->string(255)->null(),
'sub_model_id' => $this->integer()->null(),
'sub_model_log_type' => $this->string(255)->null(),
'sub_model_as_text' => $this->string(255)->null(),
], $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.'__log_type', $tableName, ['log_type']);
$this->createIndex($tableName.'__cms_company_id', $tableName, ['cms_company_id']);
$this->createIndex($tableName.'__cms_user_id', $tableName, ['cms_user_id']);
$this->createIndex($tableName.'__model_code', $tableName, ['model_code']);
$this->createIndex($tableName.'__model_id', $tableName, ['model_id']);
$this->createIndex($tableName.'__sub_model_code', $tableName, ['sub_model_code']);
$this->createIndex($tableName.'__sub_model_id', $tableName, ['sub_model_id']);
$this->createIndex($tableName.'__sub_model_log_type', $tableName, ['sub_model_log_type']);
$this->createIndex($tableName.'__model_as_text', $tableName, ['model_as_text']);
$this->createIndex($tableName.'__sub_model_as_text', $tableName, ['sub_model_as_text']);
$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_user_id", $tableName,
'cms_user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_company_id", $tableName,
'cms_company_id', '{{%cms_company}}', '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/m240729_142301__create_table__cms_department2worker.php | src/migrations/m240729_142301__create_table__cms_department2worker.php |
<?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240729_142301__create_table__cms_department2worker extends Migration
{
public function safeUp()
{
$tableName = 'cms_department2worker';
$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(),
'cms_department_id' => $this->integer()->notNull()->comment("Отдел"),
'worker_id' => $this->integer()->notNull()->comment("Сотрудник"),
], $tableOptions);
$this->createIndex($tableName.'__worker_id', $tableName, 'worker_id');
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__cms_department_id', $tableName, 'cms_department_id');
$this->createIndex($tableName.'__uniq', $tableName, ['cms_department_id', 'worker_id']);
$this->addCommentOnTable($tableName, 'Связь отделов и сотрудников');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__worker_id", $tableName,
'worker_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_department_id", $tableName,
'cms_department_id', '{{%cms_department}}', '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/m250204_152301__create_table__cms_log_file.php | src/migrations/m250204_152301__create_table__cms_log_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 m250204_152301__create_table__cms_log_file extends Migration
{
public function safeUp()
{
$tableName = 'cms_log_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_log_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_log_id', $tableName, ['cms_log_id']);
$this->createIndex($tableName.'__storage_file_id', $tableName, ['storage_file_id']);
$this->createIndex($tableName.'__uniq', $tableName, ['storage_file_id', 'cms_log_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_log_id", $tableName,
'cms_log_id', '{{%cms_log}}', '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/m200309_174000__alter_table__cms_user_property.php | src/migrations/m200309_174000__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\Migration;
class m200309_174000__alter_table__cms_user_property extends Migration
{
public function safeUp()
{
$tableName = "cms_user_property";
$tablePropertyName = "cms_user_universal_property";
$tablePropertyEnumName = "cms_user_universal_property_enum";
$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', $tablePropertyEnumName, '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/m220811_100601__alter_table__cms_tree_type.php | src/migrations/m220811_100601__alter_table__cms_tree_type.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m220811_100601__alter_table__cms_tree_type extends Migration
{
public function safeUp()
{
$tableName = "cms_tree_type";
$this->addColumn($tableName, "meta_title_template", $this->string(500)->comment("Шаблон meta title"));
$this->addColumn($tableName, "meta_description_template", $this->text()->comment("Шаблон meta description"));
$this->addColumn($tableName, "meta_keywords_template", $this->text()->comment("Шаблон meta keywords"));
}
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/m220210_120601__alter_table__cms_user_universal_property.php | src/migrations/m220210_120601__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 m220210_120601__alter_table__cms_user_universal_property extends Migration
{
public function safeUp()
{
$tableName = "cms_user_universal_property";
$this->addColumn($tableName, "cms_site_id", $this->integer());
$this->createIndex("cms_site_id", $tableName, ['cms_site_id']);
$subQuery = $this->db->createCommand("
UPDATE
`{$tableName}` 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 "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_151000__update_data__cms_content_element_property.php | src/migrations/m200309_151000__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_151000__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_element on cms_content_element.id = cms_content_element_property.value_enum
WHERE
cms_content_property.property_type = 'E' AND
cms_content_element.id is null
")->execute();
$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();
//Memory limit problems
/*$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_element on cms_content_element.id = {$tableName}.value_enum
where
cms_content_property.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 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'
AND cms_content_property_enum.id is null")->queryAll();
$this->delete("{{%cms_content_element_property}}", [
'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_152915__alter_table__cms_user.php | src/migrations/m220127_152915__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_152915__alter_table__cms_user extends Migration
{
public function safeUp()
{
$this->dropColumn("{{%cms_user}}", "active");
$this->dropColumn("{{%cms_user}}", "_to_del_name");
}
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/m200518_101000__alter_table__cms_tree_type.php | src/migrations/m200518_101000__alter_table__cms_tree_type.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 m200518_101000__alter_table__cms_tree_type extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_tree_type}}", "is_active", $this->integer(1)->notNull()->defaultValue(1));
$this->createIndex("cms_tree_type__is_active", "{{%cms_tree_type}}", "is_active");
$this->update("{{%cms_tree_type}}", ['is_active' => 0], ['active' => 'N']);
$this->dropColumn("{{%cms_tree_type}}", "active");
$this->dropColumn("{{%cms_tree_type}}", "index_for_search");
}
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_045515__update_data_table__cms_content.php | src/migrations/m200129_045515__update_data_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_045515__update_data_table__cms_content extends Migration
{
public function safeUp()
{
$this->update("{{%cms_content}}", ['is_active' => 1], ['active' => 'Y']);
$this->update("{{%cms_content}}", ['is_active' => 0], ['active' => 'N']);
}
public function safeDown()
{
echo "m200129_045515__update_data_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/m200410_111000__alter_table__cms_content_element.php | src/migrations/m200410_111000__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\Migration;
class m200410_111000__alter_table__cms_content_element extends Migration
{
public function safeUp()
{
$tableName = "cms_content_element";
$this->addColumn($tableName, "external_id", $this->string(255)->comment("Идентификатор внешней системы"));
$this->addColumn($tableName, "cms_site_id", $this->integer());
$this->createIndex("external_id", $tableName, "external_id");
$this->createIndex("cms_site_id", $tableName, "cms_site_id");
$this->createIndex("external_id_unique", $tableName, ["cms_site_id", "external_id"], true);
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', "cms_site", 'id', 'RESTRICT', 'CASCADE'
);
}
public function safeDown()
{
echo "m200410_111000__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_135515__alter_table__cms_tree_type_property.php | src/migrations/m200307_135515__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_135515__alter_table__cms_tree_type_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_tree_type_property}}", "is_active", $this->integer(1)->notNull()->defaultValue(1));
$this->update("{{%cms_tree_type_property}}", ['is_active' => 0], ['active' => 'N']);
$this->createIndex("is_active", "{{%cms_tree_type_property}}", "is_active");
$this->renameColumn("{{%cms_tree_type_property}}", "active", "active__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/m200307_151010__alter_table__cms_user_universal_property.php | src/migrations/m200307_151010__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 m200307_151010__alter_table__cms_user_universal_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_user_universal_property}}", "is_active", $this->integer(1)->notNull()->defaultValue(1));
$this->update("{{%cms_user_universal_property}}", ['is_active' => 0], ['active' => 'N']);
$this->createIndex("is_active", "{{%cms_user_universal_property}}", "is_active");
$this->renameColumn("{{%cms_user_universal_property}}", "active", "active__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/m220210_130601__alter_table__cms_user_universal_property.php | src/migrations/m220210_130601__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 m220210_130601__alter_table__cms_user_universal_property extends Migration
{
public function safeUp()
{
$tableName = "cms_user_universal_property";
$this->dropIndex("code", $tableName);
$this->createIndex("code2cms_site_id", $tableName, ['code', '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_100601__create_table__cms_site_address_email.php | src/migrations/m200720_100601__create_table__cms_site_address_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 m200720_100601__create_table__cms_site_address_email extends Migration
{
public function safeUp()
{
$tableName = 'cms_site_address_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_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/m240730_192301__create_table__cms_user2manager.php | src/migrations/m240730_192301__create_table__cms_user2manager.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240730_192301__create_table__cms_user2manager extends Migration
{
public function safeUp()
{
$tableName = 'cms_user2manager';
$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(),
'worker_id' => $this->integer()->notNull()->comment("Сотрудник"),
'client_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.'__worker_id', $tableName, ['worker_id']);
$this->createIndex($tableName.'__client_id', $tableName, ['client_id']);
$this->createIndex($tableName.'__uniq', $tableName, ['client_id', 'worker_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}__worker_id", $tableName,
'worker_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__client_id", $tableName,
'client_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/m200510_101000__alter_table__cms_tree.php | src/migrations/m200510_101000__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\Migration;
class m200510_101000__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$tableName = "cms_tree";
$this->addColumn($tableName, "main_cms_tree_id", $this->integer()->null());
$this->addForeignKey(
"{$tableName}__main_cms_tree_id", $tableName,
'main_cms_tree_id', "cms_tree", 'id', 'SET NULL', 'SET NULL'
);
}
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/m240717_152301__create_table__cms_company_address.php | src/migrations/m240717_152301__create_table__cms_company_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 m240717_152301__create_table__cms_company_address extends Migration
{
public function safeUp()
{
$tableName = 'cms_company_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_company_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("Фото адреса"),
'postcode' => $this->string(255)->null()->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.'__postcode', $tableName, 'postcode');
$this->createIndex($tableName.'__cms_company_id', $tableName, ['cms_company_id']);
$this->createIndex($tableName.'__uniq2company', $tableName, ['cms_company_id', 'value'], true);
$this->createIndex($tableName.'__coordinates', $tableName, ['cms_company_id', 'latitude', 'longitude']);
$this->createIndex($tableName.'__cms_image_id', $tableName, ['cms_image_id']);
$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'
);
$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/m250408_152301__create_table__cms_web_notify.php | src/migrations/m250408_152301__create_table__cms_web_notify.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m250408_152301__create_table__cms_web_notify extends Migration
{
public function safeUp()
{
$tableName = 'cms_web_notify';
$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(),
'name' => $this->string(255)->notNull(),
'comment' => $this->text()->null(),
'model_code' => $this->string(255)->null(),
'model_id' => $this->integer()->null(),
'cms_user_id' => $this->integer()->notNull(),
'is_read' => $this->integer(1)->defaultValue(0)->notNull(),
], $tableOptions);
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__name', $tableName, 'name');
$this->createIndex($tableName.'__is_read', $tableName, 'is_read');
$this->createIndex($tableName.'__model_code', $tableName, ['model_code']);
$this->createIndex($tableName.'__model_id', $tableName, ['model_id']);
$this->createIndex($tableName.'__cms_user_id', $tableName, ['cms_user_id']);
$this->addCommentOnTable($tableName, 'Уведомления пользователей');
$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/m200129_025515__alter_table__cms_content.php | src/migrations/m200129_025515__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_025515__alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content}}", "element_notice", $this->text());
$this->addColumn("{{%cms_content}}", "list_notice", $this->text());
}
public function safeDown()
{
echo "m200129_025515__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/m240122_132301__alter_table__cms_tree.php | src/migrations/m240122_132301__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\Migration;
class m240122_132301__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$tableName = "cms_tree";
$this->addColumn($tableName, "shop_has_collections", $this->integer(1)->defaultValue(0)->notNull()->comment("Раздел содержит товарные коллекции"));
$this->addColumn($tableName, "shop_show_collections", $this->integer(1)->defaultValue(1)->notNull()->comment("Показывать коллекции по умолчанию"));
$this->createIndex($tableName.'__shop_has_collections', $tableName, 'shop_has_collections');
$this->createIndex($tableName.'__shop_show_collections', $tableName, 'shop_show_collections');
}
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/m200307_151000__alter_table__cms_user_universal_property.php | src/migrations/m200307_151000__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 m200307_151000__alter_table__cms_user_universal_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_user_universal_property}}", "is_multiple", $this->integer(1)->notNull()->defaultValue(0));
$this->update("{{%cms_user_universal_property}}", ['is_multiple' => 1], ['multiple' => 'Y']);
$this->createIndex("is_multiple", "{{%cms_user_universal_property}}", "is_multiple");
$this->renameColumn("{{%cms_user_universal_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/m210903_120601__alter_table__cms_content.php | src/migrations/m210903_120601__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 m210903_120601__alter_table__cms_content extends Migration
{
public function safeUp()
{
$tableName = 'cms_content';
$this->addColumn($tableName, "cms_tree_type_id", $this->integer()->comment("Элементы контента относятся к разделам этого тип"));
$this->addColumn($tableName, "saved_filter_tree_type_id", $this->integer()->comment("Это контент посадочных страниц"));
$this->createIndex("cms_tree_type_id", $tableName, ['cms_tree_type_id']);
$this->createIndex("saved_filter_tree_type_id", $tableName, ['saved_filter_tree_type_id']);
$this->addForeignKey(
"{$tableName}__cms_tree_type_id", $tableName,
'cms_tree_type_id', '{{%cms_tree_type}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__saved_filter_tree_type_id", $tableName,
'saved_filter_tree_type_id', '{{%cms_tree_type}}', 'id', 'SET NULL', 'SET NULL'
);
}
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_101000__drop_to_del_columns.php | src/migrations/m200406_101000__drop_to_del_columns.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_101000__drop_to_del_columns extends Migration
{
public function safeUp()
{
$this->dropColumn("cms_site", "server_name__to_dell");
}
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/m200428_091000__alter_table__cms_content.php | src/migrations/m200428_091000__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 m200428_091000__alter_table__cms_content extends Migration
{
public function safeUp()
{
$tableName = "cms_content";
$this->addColumn($tableName, "editable_fields", $this->text());
}
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/m200416_091000__alter_table__cms_content_element.php | src/migrations/m200416_091000__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\Migration;
class m200416_091000__alter_table__cms_content_element extends Migration
{
public function safeUp()
{
$tableName = "cms_content_element";
$this->dropIndex("tree_id_2", $tableName);
$this->dropIndex("content_id_2", $tableName);
}
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/m240717_162301__create_table__cms_company_link.php | src/migrations/m240717_162301__create_table__cms_company_link.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_162301__create_table__cms_company_link extends Migration
{
public function safeUp()
{
$tableName = 'cms_company_link';
$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(),
'link_type' => $this->string(255)->notNull(),
'url' => $this->string(255)->notNull(),
'name' => $this->string(),
'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.'__link_type', $tableName, 'link_type');
$this->createIndex($tableName.'__cms_company_id', $tableName, ['cms_company_id']);
$this->createIndex($tableName.'__uniq2company', $tableName, ['cms_company_id', 'url'], 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/m220812_100601__alter_table__cms_tree.php | src/migrations/m220812_100601__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\Migration;
class m220812_100601__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$tableName = "cms_tree";
$this->addColumn($tableName, "is_adult", $this->integer(1)->defaultValue(0)->comment("Содержит контент для взрослых?"));
$this->addColumn($tableName, "is_index", $this->integer(1)->defaultValue(1)->comment("Страница индексируется?"));
$this->addColumn($tableName, "canonical_link", $this->string(500)->comment("Canonical на другую страницу"));
$this->addColumn($tableName, "canonical_tree_id", $this->integer()->comment("Canonical раздел сайта"));
$this->addColumn($tableName, "canonical_content_element_id", $this->integer()->comment("Canonical на раздел сайта"));
$this->addColumn($tableName, "canonical_saved_filter_id", $this->integer()->comment("Canonical на сохраненный фильтр сайта"));
$this->addColumn($tableName, "redirect_content_element_id", $this->integer()->comment("Редирект на элемент"));
$this->addColumn($tableName, "redirect_saved_filter_id", $this->integer()->comment("Редирект на сохраненный фильтр"));
$this->createIndex($tableName.'__is_index', $tableName, 'is_index');
$this->createIndex($tableName.'__is_adult', $tableName, 'is_adult');
$this->createIndex($tableName.'__canonical_tree_id', $tableName, 'canonical_tree_id');
$this->createIndex($tableName.'__canonical_content_element_id', $tableName, 'canonical_content_element_id');
$this->createIndex($tableName.'__canonical_saved_filter_id', $tableName, 'canonical_saved_filter_id');
$this->createIndex($tableName.'__redirect_content_element_id', $tableName, 'redirect_content_element_id');
$this->createIndex($tableName.'__redirect_saved_filter_id', $tableName, 'redirect_saved_filter_id');
$this->addForeignKey(
"{$tableName}__canonical_tree_id", $tableName,
'canonical_tree_id', '{{%cms_tree}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__canonical_content_element_id", $tableName,
'canonical_content_element_id', '{{%cms_content_element}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__canonical_saved_filter_id", $tableName,
'canonical_saved_filter_id', '{{%cms_saved_filter}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__redirect_content_element_id", $tableName,
'redirect_content_element_id', '{{%cms_content_element}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__redirect_saved_filter_id", $tableName,
'redirect_saved_filter_id', '{{%cms_saved_filter}}', 'id', 'SET NULL', 'SET NULL'
);
}
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/m240118_132301__alter_table__cms_content.php | src/migrations/m240118_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 m240118_132301__alter_table__cms_content extends Migration
{
public function safeUp()
{
$tableName = "cms_content";
$this->addColumn($tableName, "base_role", $this->string(255)->defaultValue(null)->null()->comment("Базовая роль (товары, бренды, коллекции и т.д.)"));
$this->createIndex($tableName.'__base_content_type', $tableName, 'base_role', 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/m240821_152301__create_table__cms_company_status.php | src/migrations/m240821_152301__create_table__cms_company_status.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240821_152301__create_table__cms_company_status extends Migration
{
public function safeUp()
{
$tableName = 'cms_company_status';
$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(),
'sort' => $this->integer()->defaultValue(100)->notNull(),
], $tableOptions);
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__name', $tableName, ['name'], 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'
);
}
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/m220504_090601__create_table__cms_theme.php | src/migrations/m220504_090601__create_table__cms_theme.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m220504_090601__create_table__cms_theme extends Migration
{
public function safeUp()
{
$tableName = 'cms_theme';
$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(),
'code' => $this->string(255)->comment("Уникальный код темы")->notNull(),
'config' => $this->text()->comment("Настройки темы"),
//Можно переписать название темы, описание и фото
'name' => $this->string(255)->comment("Название темы"),
'description' => $this->string(255)->comment("Описание темы"),
'cms_image_id' => $this->integer()->comment("Фото"),
'priority' => $this->integer()->notNull()->defaultValue(100),
'is_active' => $this->integer(1)->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.'__priority', $tableName, 'priority');
$this->createIndex($tableName.'__is_active_uniq', $tableName, ['cms_site_id', 'is_active'], true);
$this->createIndex($tableName.'__code_uniq', $tableName, ['cms_site_id', 'code'], true);
$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'
);
$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/m240811_142301__create_table__cms_deal2payment.php | src/migrations/m240811_142301__create_table__cms_deal2payment.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240811_142301__create_table__cms_deal2payment extends Migration
{
public function safeUp()
{
$tableName = 'cms_deal2payment';
$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(),
'cms_deal_id' => $this->integer()->notNull()->comment("Сделка"),
'shop_payment_id' => $this->integer()->notNull()->comment("Платеж"),
], $tableOptions);
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__unique', $tableName, ['cms_deal_id', 'shop_payment_id'], true);
$this->addCommentOnTable($tableName, 'Связь сделок с платежами');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_deal_id", $tableName,
'cms_deal_id', '{{%cms_deal}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__shop_payment_id", $tableName,
'shop_payment_id', '{{%shop_payment}}', '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/m200309_173000__update_data__cms_user_property.php | src/migrations/m200309_173000__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_173000__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'")->queryAll();
$this->update("{$tableName}", [
'value_element_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/m220127_152815__update_data_table__cms_user.php | src/migrations/m220127_152815__update_data_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_152815__update_data_table__cms_user extends Migration
{
public function safeUp()
{
$this->update("{{%cms_user}}", ['is_active' => 0], ['active' => 'N']);
}
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/m140801_201442_create_user_table.php | src/migrations/m140801_201442_create_user_table.php | <?php
/**
* m140801_201442_create_user_table
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 28.10.2014
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m140801_201442_create_user_table
*/
class m140801_201442_create_user_table extends Migration
{
public function safeUp()
{
if ($this->db->driverName === 'mysql') {
$filePath = __DIR__ . "/_mysql-migrations-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);
} else if ($this->db->driverName === 'pgsql') {
$filePath = __DIR__ . "/_pgsql-migrations-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;
$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 "m140801_201442_create_user_table 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/m220125_120601__alter_table__cms_user.php | src/migrations/m220125_120601__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 m220125_120601__alter_table__cms_user extends Migration
{
public function safeUp()
{
$tableName = "cms_user";
$this->addColumn($tableName, "cms_site_id", $this->integer());
$this->createIndex("cms_site_id", $tableName, ['cms_site_id']);
$subQuery = $this->db->createCommand("
UPDATE
`cms_user` 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 "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/m240728_172718__alter_table__cms_user.php | src/migrations/m240728_172718__alter_table__cms_user.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 m240728_172718__alter_table__cms_user extends Migration
{
public function safeUp()
{
//$tableName = '{{%cms_session}}';
$tableName = 'cms_user';
$this->addColumn($tableName, "is_worker", $this->integer(1)->notNull()->defaultValue(0)->comment("Сотрудник?"));
$this->addColumn($tableName, "post", $this->string(255)->null()->comment("Должность"));
$this->addColumn($tableName, "work_shedule", $this->text()->null()->comment("Рабочий график"));
$this->createIndex($tableName.'__is_worker', $tableName, 'is_worker');
}
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/m200309_172000__alter_table__cms_user_property.php | src/migrations/m200309_172000__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\Migration;
class m200309_172000__alter_table__cms_user_property extends Migration
{
public function safeUp()
{
$tableName = "cms_user_property";
$tablePropertyName = "cms_user_universal_property";
$tablePropertyEnumName = "cms_user_universal_property_enum";
$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/m200410_161000__alter_table__cms_site.php | src/migrations/m200410_161000__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 m200410_161000__alter_table__cms_site extends Migration
{
public function safeUp()
{
$tableName = "cms_site";
$this->dropColumn($tableName, "_to_del_code");
}
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/m171121_201442_alter__view_file.php | src/migrations/m171121_201442_alter__view_file.php | <?php
/**
* m140801_201442_create_user_table
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 28.10.2014
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m171121_201442_alter__view_file
*/
class m171121_201442_alter__view_file extends Migration
{
public function safeUp()
{
if ($this->db->driverName === 'pgsql') {
$tableSchema = $this->db->getTableSchema('cms_tree_type');
if ($tableSchema->getColumn('viewfile')) {
$this->renameColumn('{{%cms_tree_type}}', 'viewfile', 'view_file');
}
$tableSchema = $this->db->getTableSchema('cms_content');
if ($tableSchema->getColumn('viewfile')) {
$this->renameColumn('{{%cms_content}}', 'viewfile', 'view_file');
}
} else {
$tableSchema = $this->db->getTableSchema('cms_tree_type');
if ($tableSchema->getColumn('viewFile')) {
$this->renameColumn('{{%cms_tree_type}}', 'viewFile', 'view_file');
}
$tableSchema = $this->db->getTableSchema('cms_content');
if ($tableSchema->getColumn('viewFile')) {
$this->renameColumn('{{%cms_content}}', 'viewFile', 'view_file');
}
}
}
public function down()
{
echo "m171121_201442_alter__view_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/m200129_065515__alter_table__cms_content.php | src/migrations/m200129_065515__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_065515__alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->dropColumn("{{%cms_content}}", "active");
}
public function safeDown()
{
echo "m200129_035515__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/m190621_015515__alter_table__cms_site_domain.php | src/migrations/m190621_015515__alter_table__cms_site_domain.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 m190621_015515__alter_table__cms_site_domain extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_site_domain}}", "is_main", $this->integer(1)->unsigned()->comment("Основной домен?"));
$this->addColumn("{{%cms_site_domain}}", "is_https", $this->integer(1)->unsigned()->comment("Работает через https?"));
$this->createIndex("is_https", "{{%cms_site_domain}}", "is_https");
$this->createIndex("is_main", "{{%cms_site_domain}}", "is_main");
$this->createIndex("is_main_unique_for_site", "{{%cms_site_domain}}", ["is_main", "cms_site_id"], true);
}
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/m240808_132301__create_table__cms_contractor_bank.php | src/migrations/m240808_132301__create_table__cms_contractor_bank.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240808_132301__create_table__cms_contractor_bank extends Migration
{
public function safeUp()
{
$tableName = 'cms_contractor_bank';
$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(),
'cms_contractor_id' => $this->integer()->notNull()->comment("Контрагент"),
'bank_name' => $this->string(255)->notNull()->comment("Банк"),
'bic' => $this->string(12)->notNull()->comment("БИК"),
'checking_account' => $this->string(20)->notNull()->comment("Расчетный счет"),
'correspondent_account' => $this->string(20)->null()->comment("Корреспондентский счёт"),
'bank_address' => $this->string(255)->null()->comment("Адрес банка"),
'comment' => $this->text()->null()->comment("Комментарий"),
'is_active' => $this->integer(1)->notNull()->defaultValue(1)->comment("Активность"),
'sort' => $this->integer()->notNull()->defaultValue(100)->comment("Сортировка"),
], $tableOptions);
$this->createIndex($tableName.'__created_by', $tableName, 'created_by');
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__bank_name', $tableName, 'bank_name');
$this->createIndex($tableName.'__cms_contractor_id', $tableName, 'cms_contractor_id');
$this->createIndex($tableName.'__bic', $tableName, 'bic');
$this->createIndex($tableName.'__checking_account', $tableName, 'checking_account');
$this->createIndex($tableName.'__is_active', $tableName, 'is_active');
$this->createIndex($tableName.'__sort', $tableName, 'sort');
$this->createIndex($tableName.'__unique', $tableName, ['cms_contractor_id', 'bic', 'checking_account'], true);
$this->addCommentOnTable($tableName, 'Банковские реквизиты');
$this->addForeignKey(
"{$tableName}__created_by", $tableName,
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_contractor_id", $tableName,
'cms_contractor_id', '{{%cms_contractor}}', '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/m240717_132301__create_table__cms_company_email.php | src/migrations/m240717_132301__create_table__cms_company_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 m240717_132301__create_table__cms_company_email extends Migration
{
public function safeUp()
{
$tableName = 'cms_company_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_company_id' => $this->integer()->notNull(),
'value' => $this->string(255)->notNull()->comment("Email"),
'name' => $this->string(255)->comment("Примечание к Email"),
'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, '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'
);
//Удаляя компанию - удаляются и все 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/m200129_055515__update_data_table__cms_content.php | src/migrations/m200129_055515__update_data_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_055515__update_data_table__cms_content extends Migration
{
public function safeUp()
{
$this->update("{{%cms_content}}", ['is_allow_change_tree' => 1], ['is_allow_change_tree' => 'Y']);
$this->update("{{%cms_content}}", ['is_allow_change_tree' => 0], ['is_allow_change_tree' => 'N']);
}
public function safeDown()
{
echo "m200129_045515__update_data_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/m200527_101000__alter_table__cms_content_property.php | src/migrations/m200527_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\Schema;
use yii\db\Migration;
class m200527_101000__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$tableName = "cms_content_property";
$this->addColumn($tableName, "cms_site_id", $this->integer());
$this->addForeignKey(
"{$tableName}__cms_site_id", $tableName,
'cms_site_id', '{{%cms_site}}', '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/m220812_110601__alter_table__cms_content_element.php | src/migrations/m220812_110601__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\Migration;
class m220812_110601__alter_table__cms_content_element extends Migration
{
public function safeUp()
{
$tableName = "cms_content_element";
$this->addColumn($tableName, "is_adult", $this->integer(1)->defaultValue(0)->comment("Содержит контент для взрослых?"));
$this->createIndex($tableName.'__is_adult', $tableName, 'is_adult');
}
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/m200307_151020__alter_table__cms_user_universal_property.php | src/migrations/m200307_151020__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 m200307_151020__alter_table__cms_user_universal_property extends Migration
{
public function safeUp()
{
$this->update("{{%cms_user_universal_property}}", ['is_required' => 0], ['is_required' => 'N']);
$this->update("{{%cms_user_universal_property}}", ['is_required' => 1], ['is_required' => 'Y']);
$this->alterColumn("{{%cms_user_universal_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/m180109_224042_update__cms_content_element_property.php | src/migrations/m180109_224042_update__cms_content_element_property.php | <?php
/**
* m140801_201442_create_user_table
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 28.10.2014
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m171121_201442_alter__view_file
*/
class m180109_224042_update__cms_content_element_property extends Migration
{
public function safeUp()
{
if ($this->db->driverName === 'pgsql') {
$this->update('{{%cms_content_element_property}}', [
'value_enum' => new \yii\db\Expression('value::INTEGER'),
'value_num' => new \yii\db\Expression('value::FLOAT'),
'value_string' => new \yii\db\Expression('value::TEXT'),
]);
} else {
$this->update('{{%cms_content_element_property}}', [
'value_enum' => new \yii\db\Expression('value'),
'value_num' => new \yii\db\Expression('value'),
'value_string' => new \yii\db\Expression('value'),
]);
}
}
public function down()
{
echo "m180109_224042_update__cms_content_element_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/m250219_132301__create_table__cms_project.php | src/migrations/m250219_132301__create_table__cms_project.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_132301__create_table__cms_project extends Migration
{
public function safeUp()
{
$tableName = 'cms_project';
$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("Описание проекта"),
'is_active' => $this->boolean()->notNull()->defaultValue(1)->comment("Активность"),
'is_private' => $this->boolean()->notNull()->defaultValue(1)->comment("Закрытый?"),
'cms_image_id' => $this->integer()->comment("Фото"),
'cms_company_id' => $this->integer()->comment("Компания"),
'cms_user_id' => $this->integer()->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.'__is_active', $tableName, 'is_active');
$this->createIndex($tableName.'__is_private', $tableName, 'is_private');
$this->createIndex($tableName.'__cms_company_id', $tableName, 'cms_company_id');
$this->createIndex($tableName.'__cms_user_id', $tableName, 'cms_user_id');
$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'
);
$this->addForeignKey(
"{$tableName}__cms_company_id", $tableName,
'cms_company_id', '{{%cms_company}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
"{$tableName}__cms_user_id", $tableName,
'cms_user_id', '{{%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/m250701_152301__create_table__cms_compare_element.php | src/migrations/m250701_152301__create_table__cms_compare_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 m250701_152301__create_table__cms_compare_element extends Migration
{
public function safeUp()
{
$tableName = 'cms_compare_element';
$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(),
'cms_content_element_id' => $this->integer()->notNull(),
'shop_user_id' => $this->integer()->notNull(),
], $tableOptions);
$this->createIndex($tableName.'__created_at', $tableName, 'created_at');
$this->createIndex($tableName.'__unique', $tableName, ['shop_user_id', 'cms_content_element_id'], true);
$this->addCommentOnTable($tableName, 'Списки элементов для сравнения');
$this->addForeignKey(
"{$tableName}__shop_user_id", $tableName,
'shop_user_id', '{{%shop_user}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_content_element_id", $tableName,
'cms_content_element_id', '{{%cms_content_element}}', '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/m240607_172718_alter_table__cms_callcheck_message.php | src/migrations/m240607_172718_alter_table__cms_callcheck_message.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_172718_alter_table__cms_callcheck_message extends Migration
{
public function safeUp()
{
//$tableName = '{{%cms_session}}';
$tableName = 'cms_callcheck_message';
$this->alterColumn($tableName, "user_ip", $this->string(255));
}
public function safeDown()
{
$this->dropTable("{{%cms_callcheck_message}}");
}
}
| 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/m240821_172301__create_table__cms_company2category.php | src/migrations/m240821_172301__create_table__cms_company2category.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Migration;
class m240821_172301__create_table__cms_company2category extends Migration
{
public function safeUp()
{
$tableName = 'cms_company2category';
$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(),
'cms_company_id' => $this->integer()->notNull()->comment("Компания"),
'cms_company_category_id' => $this->integer()->notNull()->comment("Категория"),
], $tableOptions);
$this->createIndex($tableName.'__uniq', $tableName, ['cms_company_id', 'cms_company_category_id'], true);
$this->addCommentOnTable($tableName, 'Связь компании с категорией');
$this->addForeignKey(
"{$tableName}__cms_company_id", $tableName,
'cms_company_id', '{{%cms_company}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_company_category_id", $tableName,
'cms_company_category_id', '{{%cms_company_category}}', '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_225515__alter_table__cms_lang.php | src/migrations/m190412_225515__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_225515__alter_table__cms_lang extends Migration
{
public function safeUp()
{
$this->dropColumn("{{%cms_lang}}", "active");
}
public function safeDown()
{
echo "m190412_225515__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/m220127_230601__update_data__user_email_and_phone.php | src/migrations/m220127_230601__update_data__user_email_and_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 m220127_230601__update_data__user_email_and_phone extends Migration
{
public function safeUp()
{
$this->db->createCommand(<<<SQL
INSERT IGNORE
INTO cms_user_email (`cms_site_id`,`cms_user_id`,`value`, `is_approved`)
SELECT
u.cms_site_id,
u.id,
u.email,
u.email_is_approved
FROM cms_user as u
WHERE
u.email is not null
;
SQL
)->execute();
$this->db->createCommand(<<<SQL
INSERT IGNORE
INTO cms_user_phone (`cms_site_id`,`cms_user_id`,`value`, `is_approved`)
SELECT
u.cms_site_id,
u.id,
u.phone,
u.phone_is_approved
FROM cms_user as u
WHERE
u.phone is not null
;
SQL
)->execute();
}
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/m250603_192301__alter_table__cms_storage_file.php | src/migrations/m250603_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 m250603_192301__alter_table__cms_storage_file extends Migration
{
public function safeUp()
{
//$tableName = '{{%cms_session}}';
$tableName = 'cms_storage_file';
$this->alterColumn($tableName, "cluster_file", $this->string(400)->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/m250219_142301__create_table__cms_project2manager.php | src/migrations/m250219_142301__create_table__cms_project2manager.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_142301__create_table__cms_project2manager extends Migration
{
public function safeUp()
{
$tableName = 'cms_project2manager';
$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/m251022_162301__create_table__cms_faq2tree.php | src/migrations/m251022_162301__create_table__cms_faq2tree.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_162301__create_table__cms_faq2tree extends Migration
{
public function safeUp()
{
$tableName = 'cms_faq2tree';
$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(),
'cms_faq_id' => $this->integer()->notNull()->comment("Faq"),
'cms_tree_id' => $this->integer()->notNull()->comment("Раздел"),
], $tableOptions);
$this->createIndex($tableName.'__uniq', $tableName, ['cms_faq_id', 'cms_tree_id'], true);
$this->addCommentOnTable($tableName, 'Связь вопрос/ответ с разделом');
$this->addForeignKey(
"{$tableName}__cms_faq_id", $tableName,
'cms_faq_id', '{{%cms_faq}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
"{$tableName}__cms_tree_id", $tableName,
'cms_tree_id', '{{%cms_tree}}', '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/m240821_182301__alter_table__cms_company2user.php | src/migrations/m240821_182301__alter_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 m240821_182301__alter_table__cms_company2user extends Migration
{
public function safeUp()
{
//$tableName = '{{%cms_session}}';
$tableName = 'cms_company2user';
$this->addColumn($tableName, "comment", $this->string(255)->null()->comment("Комментарий"));
$this->addColumn($tableName, "sort", $this->integer()->notNull()->defaultValue(100)->comment("Сортировка"));
$this->addColumn($tableName, "is_root", $this->integer(0)->notNull()->defaultValue(1)->comment("Доступны все данные по копании?"));
$this->addColumn($tableName, "is_notify", $this->integer(0)->notNull()->defaultValue(1)->comment("Отправлять уведомления?"));
$this->createIndex($tableName.'__comment', $tableName, 'comment');
$this->createIndex($tableName.'__sort', $tableName, 'sort');
$this->createIndex($tableName.'__is_root', $tableName, 'is_root');
$this->createIndex($tableName.'__is_notify', $tableName, 'is_notify');
}
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/m220127_220601__create_table__cms_user_phone.php | src/migrations/m220127_220601__create_table__cms_user_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 m220127_220601__create_table__cms_user_phone extends Migration
{
public function safeUp()
{
$tableName = 'cms_user_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(),
'cms_user_id' => $this->integer()->notNull(),
'value' => $this->string(255)->notNull()->comment("Телефон"),
'name' => $this->string(255)->comment("Примечание к телефону"),
'sort' => $this->integer()->notNull()->defaultValue(500),
'is_approved' => $this->integer()->notNull()->defaultValue(0)->comment("Телефон подтвержден?"),
'approved_key' => $this->string(255)->comment("Ключ для подтверждения телефона"),
'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, 'Телефоны пользователей');
$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/m190621_025515__alter_table__cms_site_domain.php | src/migrations/m190621_025515__alter_table__cms_site_domain.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 m190621_025515__alter_table__cms_site_domain extends Migration
{
public function safeUp()
{
$this->renameColumn("{{%cms_site}}", "server_name", "server_name__to_dell");
}
public function safeDown()
{
echo "m190621_025515__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/m190412_205515__alter_table__cms_lang.php | src/migrations/m190412_205515__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_205515__alter_table__cms_lang extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_lang}}", "is_active", $this->integer(1)->notNull()->defaultValue(0));
$this->createIndex("is_active", "{{%cms_lang}}", "is_active");
}
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/m201006_101000__alter_table__cms_content_element.php | src/migrations/m201006_101000__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 m201006_101000__alter_table__cms_content_element extends Migration
{
public function safeUp()
{
$tableName = "cms_content_element";
$this->dropIndex("external_id_unique", $tableName);
$this->createIndex("external_id_unique", $tableName, ['cms_site_id', 'external_id', 'content_id'], true);
}
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/m220128_010601__alter_table__cms_user.php | src/migrations/m220128_010601__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 m220128_010601__alter_table__cms_user extends Migration
{
public function safeUp()
{
$tableName = "{{%cms_user}}";
$this->renameColumn($tableName, "email", '__to_del__email');
$this->renameColumn($tableName, "phone", '__to_del__phone');
$this->renameColumn($tableName, "email_is_approved", '__to_del__email_is_approved');
$this->renameColumn($tableName, "phone_is_approved", '__to_del__phone_is_approved');
}
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/m240717_192301__create_table__cms_company2manager.php | src/migrations/m240717_192301__create_table__cms_company2manager.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_192301__create_table__cms_company2manager extends Migration
{
public function safeUp()
{
$tableName = 'cms_company2manager';
$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/m201109_111000__alter_table__cms_site.php | src/migrations/m201109_111000__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 m201109_111000__alter_table__cms_site extends Migration
{
public function safeUp()
{
$tableName = 'cms_site';
$this->addColumn($tableName, "internal_name", $this->string(255)->null());
}
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/m251127_142301__alter_table__cms_content_property_enum.php | src/migrations/m251127_142301__alter_table__cms_content_property_enum.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_142301__alter_table__cms_content_property_enum extends Migration
{
public function safeUp()
{
$tableName = "cms_content_property_enum";
$this->addColumn($tableName, "color", $this->string(255)->comment("Цвет"));
$this->createIndex($tableName. "__color", $tableName, ["color"]);
}
public function safeDown()
{
echo "m251127_142301__alter_table__cms_content_property_enum 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/m220128_020601__alter_table__cms_user.php | src/migrations/m220128_020601__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 m220128_020601__alter_table__cms_user extends Migration
{
public function safeUp()
{
$tableName = "{{%cms_user}}";
$this->alterColumn($tableName, "username", $this->string(255)->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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.