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/v3/m170515_033840__alter_table__cms_tree_type_property.php | src/migrations/v3/m170515_033840__alter_table__cms_tree_type_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170515_033840__alter_table__cms_tree_type_property extends Migration
{
public function safeUp()
{
$this->dropColumn("{{%cms_tree_type_property}}", "multiple_cnt");
$this->dropColumn("{{%cms_tree_type_property}}", "with_description");
$this->dropColumn("{{%cms_tree_type_property}}", "searchable");
$this->dropColumn("{{%cms_tree_type_property}}", "filtrable");
$this->dropColumn("{{%cms_tree_type_property}}", "version");
$this->dropColumn("{{%cms_tree_type_property}}", "smart_filtrable");
}
public function safeDown()
{
echo "m170515_033840__alter_table__cms_tree_type_property cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_133347__alter_table__cms_content_property.php | src/migrations/v3/m170701_133347__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 m170701_133347__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$this->dropForeignKey("cms_content_property_created_by", "{{%cms_content_property}}");
$this->dropForeignKey("cms_content_property_updated_by", "{{%cms_content_property}}");
$this->addForeignKey(
'cms_content_property__created_by', "{{%cms_content_property}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_property__updated_by', "{{%cms_content_property}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m170701_133344__alter_table__cms_tree_property cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m151023_173220_alter_table__cms_tree_type.php | src/migrations/v3/m151023_173220_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;
use yii\helpers\Json;
class m151023_173220_alter_table__cms_tree_type extends Migration
{
public function safeUp()
{
$this->addColumn('{{%cms_tree_type}}', 'viewFile', $this->string(255));
$this->addColumn('{{%cms_tree_type}}', 'default_children_tree_type', $this->integer()); //При создании дочерние разделы будут этого типа.
$this->createIndex('viewFile', '{{%cms_tree_type}}', 'viewFile');
$this->createIndex('default_children_tree_type', '{{%cms_tree_type}}', 'default_children_tree_type');
$this->addForeignKey(
'cms_tree_type__default_children_tree_type', "{{%cms_tree_type}}",
'default_children_tree_type', '{{%cms_tree_type}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m151023_153220_alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m141019_162718_create_comment_table.php | src/migrations/v3/m141019_162718_create_comment_table.php | <?php
use yii\db\Schema;
use yii\db\Migration;
class m141019_162718_create_comment_table extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_comment}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_comment}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'content' => Schema::TYPE_TEXT,
'files' => Schema::TYPE_TEXT. ' NULL', //
'linked_to_model' => Schema::TYPE_STRING. '(255) NOT NULL', //Коммент обязательно должен быть к кому то привязан
'linked_to_value' => Schema::TYPE_STRING. '(255) NOT NULL', //Коммент обязательно должен быть к кому то привязан
'count_subscribe' => Schema::TYPE_INTEGER . ' NULL',
'users_subscribers' => Schema::TYPE_TEXT. ' NULL', //Пользователи которые подписались (их id через запятую)
'count_vote' => Schema::TYPE_INTEGER . ' NULL', //Количество голосов
'result_vote' => Schema::TYPE_INTEGER . ' NULL', //Результат голосования
'users_votes_up' => Schema::TYPE_TEXT. ' NULL', //Пользователи которые проголосовали +
'users_votes_down' => Schema::TYPE_TEXT. ' NULL', //Пользователи которые проголосовали -
'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', //статус, активна некативна, удалено
'status_adult' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0', //Возрастной статус 0 - не проверено, 1-для всех, 2-типо эротические материалы, 3-порно
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_comment}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_comment}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_comment}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_comment}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_comment}} ADD INDEX(linked_to_model);");
$this->execute("ALTER TABLE {{%cms_comment}} ADD INDEX(linked_to_value);");
$this->execute("ALTER TABLE {{%cms_comment}} ADD INDEX(count_subscribe);");
$this->execute("ALTER TABLE {{%cms_comment}} ADD INDEX(count_vote);");
$this->execute("ALTER TABLE {{%cms_comment}} ADD INDEX(result_vote);");
$this->execute("ALTER TABLE {{%cms_comment}} ADD INDEX(status);");
$this->execute("ALTER TABLE {{%cms_comment}} ADD INDEX(status_adult);");
$this->execute("ALTER TABLE {{%cms_comment}} COMMENT = 'Комментарий к игре';");
$this->addForeignKey(
'comment_created_by', "{{%cms_comment}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'comment_updated_by', "{{%cms_comment}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
$this->dropForeignKey("comment_created_by", "{{%cms_comment}}");
$this->dropForeignKey("comment_updated_by", "{{%cms_comment}}");
$this->dropTable("{{%cms_comment}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m151030_193220_alter_table__cms_tree.php | src/migrations/v3/m151030_193220_alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\Json;
class m151030_193220_alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->addColumn('{{%cms_tree}}', 'name_hidden', $this->string(255));
$this->createIndex('name_hidden', '{{%cms_tree}}', 'name_hidden');
}
public function safeDown()
{
echo "m151030_193220_alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150324_273205_alter_table__cms_infoblock.php | src/migrations/v3/m150324_273205_alter_table__cms_infoblock.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150324_273205_alter_table__cms_infoblock extends Migration
{
public function up()
{
$this->execute("ALTER TABLE {{%cms_infoblock%}} ADD `protected_widget` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Запрет на смену виджета.' ,
ADD `auto_created` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Автоматически созданный инфоблок' ;");
}
public function down()
{
echo "m150324_273205_alter_table__cms_infoblock cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m141019_162726_create_vote_table.php | src/migrations/v3/m141019_162726_create_vote_table.php | <?php
use yii\db\Schema;
use yii\db\Migration;
class m141019_162726_create_vote_table extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_vote}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_vote}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'value' => Schema::TYPE_SMALLINT . '(1)',
'linked_to_model' => Schema::TYPE_STRING. '(255) NOT NULL', //Коммент обязательно должен быть к кому то привязан
'linked_to_value' => Schema::TYPE_STRING. '(255) NOT NULL', //Коммент обязательно должен быть к кому то привязан
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_vote}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_vote}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_vote}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_vote}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_vote}} ADD INDEX(value);");
$this->execute("ALTER TABLE {{%cms_vote}} ADD INDEX(linked_to_model);");
$this->execute("ALTER TABLE {{%cms_vote}} ADD INDEX(linked_to_value);");
$this->execute("ALTER TABLE {{%cms_vote}} ADD UNIQUE(linked_to_model, linked_to_value, created_by);"); //на одну сущьность пользователь может подписаться 1 раз
$this->execute("ALTER TABLE {{%cms_vote}} COMMENT = 'Голос, плюс минус';");
$this->addForeignKey(
'vote_created_by', "{{%cms_vote}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'vote_updated_by', "{{%cms_vote}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
$this->dropForeignKey("vote_created_by", "{{%cms_vote}}");
$this->dropForeignKey("vote_updated_by", "{{%cms_vote}}");
$this->dropTable("{{%cms_vote}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150702_114030_alter_table__cms_user.php | src/migrations/v3/m150702_114030_alter_table__cms_user.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150702_114030_alter_table__cms_user extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_user}} ADD `last_activity_at` INT NULL ;");
$this->execute("ALTER TABLE {{%cms_user}} ADD INDEX(last_activity_at);");
$this->execute("ALTER TABLE {{%cms_user}} ADD `last_admin_activity_at` INT NULL ;");
$this->execute("ALTER TABLE {{%cms_user}} ADD INDEX(last_admin_activity_at);");
}
public function down()
{
echo "m150702_114030_alter_table__cms_user cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150922_234220_update_data__cms_tree.php | src/migrations/v3/m150922_234220_update_data__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 30.07.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150922_234220_update_data__cms_tree extends Migration
{
public function safeUp()
{
if ($models = \skeeks\cms\models\Tree::find()->all())
{
/**
* @var $model \skeeks\cms\models\Tree
*/
foreach ($models as $model)
{
if (!method_exists($model, 'getMainImageSrc'))
{
continue;
}
//$user->getFiles()
$imageSrc = $model->getMainImageSrcOld();
if ($imageSrc)
{
$storageFile = \skeeks\cms\models\CmsStorageFile::find()->where(['src' => $imageSrc])->one();
if ($storageFile)
{
$model->image_id = $storageFile->id;
$model->image_full_id = $storageFile->id;
$model->save(false);
}
}
}
}
}
public function down()
{
echo "m150922_234220_update_data__cms_tree cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150922_223220_update_data__cms_user.php | src/migrations/v3/m150922_223220_update_data__cms_user.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 30.07.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150922_223220_update_data__cms_user extends Migration
{
public function safeUp()
{
if ($users = \skeeks\cms\models\User::find()->all())
{
/**
* @var $user \skeeks\cms\models\User
*/
foreach ($users as $user)
{
if (!method_exists($user, 'getMainImageSrc'))
{
continue;
}
//$user->getFiles()
$imageSrc = $user->getMainImageSrc();
if ($imageSrc)
{
$storageFile = \skeeks\cms\models\CmsStorageFile::find()->where(['src' => $imageSrc])->one();
if ($storageFile)
{
$user->image_id = $storageFile->id;
$user->save(false);
}
}
}
}
}
public function down()
{
echo "m150922_223220_update_data__cms_user cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_133510__alter_table__cms_tree_property.php | src/migrations/v3/m170701_133510__alter_table__cms_tree_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170701_133510__alter_table__cms_tree_property extends Migration
{
public function safeUp()
{
$this->delete("{{%cms_tree_property}}", [
'or',
['element_id' => null],
['property_id' => null],
]);
$this->dropForeignKey('cms_tree_property_element_id', '{{%cms_tree_property}}');
$this->dropForeignKey('cms_tree_property_property_id', '{{%cms_tree_property}}');
$this->alterColumn("{{%cms_tree_property}}", 'element_id', $this->integer()->notNull());
$this->alterColumn("{{%cms_tree_property}}", 'property_id', $this->integer()->notNull());
$this->addForeignKey(
'cms_tree_property_element_id', "{{%cms_tree_property}}",
'element_id', '{{%cms_tree}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_tree_property_property_id', "{{%cms_tree_property}}",
'property_id', '{{%cms_tree_type_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m170701_133510__alter_table__cms_tree_property cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150923_183220_alter_table__tree__content_element.php | src/migrations/v3/m150923_183220_alter_table__tree__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;
use yii\helpers\Json;
class m150923_183220_alter_table__tree__content_element extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_tree}} CHANGE `files` `files_depricated` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;;");
$this->execute("ALTER TABLE {{%cms_content_element}} CHANGE `files` `files_depricated` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;;");
}
public function safeDown()
{
echo "m150923_173220_update_data__images_and_files cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150327_273210_create_table__cms_settings.php | src/migrations/v3/m150327_273210_create_table__cms_settings.php | <?php
/**
* m150121_273200_create_table__cms_settings
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 27.01.2015
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m150121_273200_create_table__cms_settings
*/
class m150327_273210_create_table__cms_settings extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_settings}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_settings}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'component' => Schema::TYPE_STRING. '(255)',
'value' => Schema::TYPE_TEXT. ' NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_settings}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_settings}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_settings}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_settings}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_settings}} ADD INDEX(component);");
$this->execute("ALTER TABLE {{%cms_settings}} ADD UNIQUE(component);");
$this->addForeignKey(
'cms_settings_created_by', "{{%cms_settings}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_settings_updated_by', "{{%cms_settings}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function down()
{
$this->dropForeignKey("cms_settings_created_by", "{{%cms_settings}}");
$this->dropForeignKey("cms_settings_updated_by", "{{%cms_settings}}");
$this->dropTable("{{%cms_settings}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170622_043840__alter_table__drop_list_type.php | src/migrations/v3/m170622_043840__alter_table__drop_list_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 m170622_043840__alter_table__drop_list_type extends Migration
{
public function safeUp()
{
$this->dropColumn("{{%cms_content_property}}", "list_type");
$this->dropColumn("{{%cms_tree_type_property}}", "list_type");
$this->dropColumn("{{%cms_user_universal_property}}", "list_type");
}
public function safeDown()
{
echo "m170622_043840__alter_table__drop_list_type cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150730_103220_create_table__cms_session.php | src/migrations/v3/m150730_103220_create_table__cms_session.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 m150730_103220_create_table__cms_session extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_session}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_session}}", [
'id' => 'CHAR(64) NOT NULL PRIMARY KEY',
'expire' => Schema::TYPE_INTEGER,
'data' => 'LONGTEXT NULL',
//'data' => 'BLOB',
'created_at' => Schema::TYPE_INTEGER,
'updated_at' => Schema::TYPE_INTEGER,
'ip' => Schema::TYPE_STRING . '(32) NULL',
'data_server' => Schema::TYPE_TEXT . ' NULL',
'data_cookie' => Schema::TYPE_TEXT . ' NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_session}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_session}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_session}} ADD INDEX(expire);");
$this->execute("ALTER TABLE {{%cms_session}} ADD INDEX(ip);");
/*
$this->execute("CREATE TABLE {{%cms_session}}
(
id CHAR(64) NOT NULL PRIMARY KEY,
expire INTEGER,
data BLOB
)");*/
}
public function safeDown()
{
$this->dropTable('{{%cms_session}}');
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_133505__alter_table__cms_content_element_property.php | src/migrations/v3/m170701_133505__alter_table__cms_content_element_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170701_133505__alter_table__cms_content_element_property extends Migration
{
public function safeUp()
{
$this->delete("{{%cms_content_element_property}}", [
'or',
['element_id' => null],
['property_id' => null],
]);
$this->dropForeignKey('cms_content_element_property_element_id', '{{%cms_content_element_property}}');
$this->dropForeignKey('cms_content_element_property_property_id', '{{%cms_content_element_property}}');
$this->alterColumn("{{%cms_content_element_property}}", 'element_id', $this->integer()->notNull());
$this->alterColumn("{{%cms_content_element_property}}", 'property_id', $this->integer()->notNull());
$this->addForeignKey(
'cms_content_element_property_element_id', "{{%cms_content_element_property}}",
'element_id', '{{%cms_content_element}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_content_element_property_property_id', "{{%cms_content_element_property}}",
'property_id', '{{%cms_content_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m170701_133505__alter_table__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/v3/m150122_273205_alter_table__cms_user__emails_adn_phones.php | src/migrations/v3/m150122_273205_alter_table__cms_user__emails_adn_phones.php | <?php
/**
* m150122_273205_alter_table__cms_user__emails_adn_phones
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 24.02.2015
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
class m150122_273205_alter_table__cms_user__emails_adn_phones extends Migration
{
public function up()
{
$this->execute("ALTER TABLE {{%cms_user_email}} CHANGE `user_id` `user_id` INT(11) NULL");
$this->execute("ALTER TABLE {{%cms_user_phone}} CHANGE `user_id` `user_id` INT(11) NULL");
}
public function down()
{
echo "m150122_273205_alter_table__cms_user__emails_adn_phones cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m151113_113220_alter_table__cms_site_and_lang.php | src/migrations/v3/m151113_113220_alter_table__cms_site_and_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;
use yii\helpers\Json;
class m151113_113220_alter_table__cms_site_and_lang extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE `cms_site` ADD `image_id` INT(11) NULL AFTER `description`;");
$this->execute("ALTER TABLE `cms_lang` ADD `image_id` INT(11) NULL AFTER `description`;");
$this->addForeignKey(
'cms_site__image_id', "{{%cms_site}}",
'image_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_lang__image_id', "{{%cms_lang}}",
'image_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m151113_113220_alter_table__cms_site_and_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/v3/m141106_100557_create_user_group_table.php | src/migrations/v3/m141106_100557_create_user_group_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 m141106_100557_create_user_group_table
*/
class m141106_100557_create_user_group_table extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_user_group}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable('{{%cms_user_group}}', [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'groupname' => Schema::TYPE_STRING . ' NOT NULL',
'description' => Schema::TYPE_STRING . '(32) NOT NULL',
'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10',
'files' => Schema::TYPE_TEXT. ' NULL', //
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_user_group}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_user_group}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_user_group}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_user_group}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_user_group}} ADD UNIQUE(groupname);");
$this->execute("ALTER TABLE {{%cms_user_group}} COMMENT = 'Группа пользователя';");
$this->addForeignKey(
'user_group_created_by', "{{%cms_user_group}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'user_group_updated_by', "{{%cms_user_group}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->insert('{{%cms_user_group}}', [
"groupname" => "root",
"description" => "Суперпользователи",
"status" => 10,
]);
$this->insert('{{%cms_user_group}}', [
"groupname" => "admin",
"description" => "Администраторы",
"status" => 10,
]);
$this->insert('{{%cms_user_group}}', [
"groupname" => "manager",
"description" => "Менеджер",
"status" => 10,
]);
$this->insert('{{%cms_user_group}}', [
"groupname" => "user",
"description" => "Пользователь",
"status" => 10,
]);
$this->execute("ALTER TABLE {{%cms_user}} ADD `group_id` INT(11) NULL;");
$this->addForeignKey(
'user_user_group_updated_by', "{{%cms_user}}",
'group_id', '{{%cms_user_group}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->insert('{{%cms_user}}', [
"username" => "root",
"name" => "Семенов Александр",
"city" => "Зеленоград",
"address" => "Зеленоград, ул. Каменка, 2004-25",
"auth_key" => "otv60YW-nV6-8GRI4La3vYNhu_-dmp_n",
"password_hash" => '$2y$13$tEMlbu9DvkU3RDCg.sZwM.JNScy.HJXFqG.Ew.n5fwcdAPxHsFdla',
"password_reset_token" => 'wn49wJLj9OMVjgj8bBzBjND4nFixyJgt_1413297645',
"email" => 'admin@skeeks.com',
"role" => 10,
"status" => 10,
"group_id" => 1,
]);
}
public function down()
{
$this->dropForeignKey("user_user_group_updated_by", "{{%cms_user}}");
$this->dropForeignKey("user_group_created_by", "{{%cms_user_group}}");
$this->dropForeignKey("user_group_updated_by", "{{%cms_user_group}}");
$this->dropColumn('{{%cms_user}}', 'group_id');
$this->dropTable('{{%cms_user_group}}');
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150121_273200_create_table__cms_user_phone.php | src/migrations/v3/m150121_273200_create_table__cms_user_phone.php | <?php
/**
* m150121_273200_create_table__cms_user_phone
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 27.01.2015
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m150121_273200_create_table__cms_user_phone
*/
class m150121_273200_create_table__cms_user_phone extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_user_phone}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_user_phone}}", [
'id' => Schema::TYPE_PK,
'user_id' => Schema::TYPE_INTEGER . ' NOT NULL',
'value' => Schema::TYPE_STRING. '(255) NOT NULL',
'approved' => Schema::TYPE_SMALLINT,
'approved_key' => Schema::TYPE_STRING. '(255)',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_user_phone}} ADD INDEX(approved_key);");
$this->execute("ALTER TABLE {{%cms_user_phone}} ADD INDEX(approved);");
$this->execute("ALTER TABLE {{%cms_user_phone}} ADD INDEX(user_id);");
$this->execute("ALTER TABLE {{%cms_user_phone}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_user_phone}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_user_phone}} ADD UNIQUE(value);");
$this->addForeignKey(
'cms_user_phone_user_id', "{{%cms_user_phone}}",
'user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function down()
{
$this->dropForeignKey("cms_user_phone_user_id", "{{%cms_user_phone}}");
$this->dropTable("{{%cms_user_phone}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160313_203220__alter_table__cms_storage_file.php | src/migrations/v3/m160313_203220__alter_table__cms_storage_file.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 21.02.2016
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\Json;
class m160313_203220__alter_table__cms_storage_file extends Migration
{
public function safeUp()
{
$this->dropIndex('linked_to_model', '{{%cms_storage_file}}');
$this->dropColumn('{{%cms_storage_file}}', 'linked_to_model');
$this->dropIndex('linked_to_value', '{{%cms_storage_file}}');
$this->dropColumn('{{%cms_storage_file}}', 'linked_to_value');
$this->dropIndex('type', '{{%cms_storage_file}}');
$this->dropColumn('{{%cms_storage_file}}', 'type');
$this->dropIndex('published_at', '{{%cms_storage_file}}');
$this->dropColumn('{{%cms_storage_file}}', 'published_at');
$this->dropIndex('src', '{{%cms_storage_file}}');
$this->dropColumn('{{%cms_storage_file}}', 'src');
}
public function safeDown()
{
echo "m160313_203220__alter_table__cms_storage_file cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150922_213220_alter_table__cms_user.php | src/migrations/v3/m150922_213220_alter_table__cms_user.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 30.07.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150922_213220_alter_table__cms_user extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_user}} ADD `image_id` INT(11) NULL DEFAULT NULL AFTER `name`;");
$this->createIndex('image_id', '{{%cms_user}}', 'image_id');
$this->addForeignKey(
'cms_user__image_id', "{{%cms_user}}",
'image_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function down()
{
echo "m150922_213220_alter_table__cms_user cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150826_113220_create_table__cms_user_universal_property.php | src/migrations/v3/m150826_113220_create_table__cms_user_universal_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 10.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150826_113220_create_table__cms_user_universal_property extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_user_universal_property}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_user_universal_property}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'name' => Schema::TYPE_STRING . '(255) NOT NULL',
'code' => Schema::TYPE_STRING . '(64) NULL',
'active' => "CHAR(1) NOT NULL DEFAULT 'Y'",
'priority' => "INT NOT NULL DEFAULT '500'",
'property_type' => "CHAR(1) NOT NULL DEFAULT 'S'",
'list_type' => "CHAR(1) NOT NULL DEFAULT 'L'",
'multiple' => "CHAR(1) NOT NULL DEFAULT 'N'",
'multiple_cnt' => "INT NULL",
'with_description' => "CHAR(1) NULL",
'searchable' => "CHAR(1) NOT NULL DEFAULT 'N'",
'filtrable' => "CHAR(1) NOT NULL DEFAULT 'N'",
'is_required' => "CHAR(1) NULL",
'version' => "INT NOT NULL DEFAULT '1'",
'component' => "VARCHAR(255) NULL",
'component_settings' => "TEXT NULL",
'hint' => "VARCHAR(255) NULL",
'smart_filtrable' => "CHAR(1) NOT NULL DEFAULT 'N'",
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD UNIQUE(code);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(active);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(property_type);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(list_type);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(multiple);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(multiple_cnt);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(with_description);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(searchable);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(filtrable);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(is_required);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(version);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(component);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(hint);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} ADD INDEX(smart_filtrable);");
$this->execute("ALTER TABLE {{%cms_user_universal_property}} COMMENT = 'Свойства пользователей';");
$this->addForeignKey(
'cms_user_universal_property_created_by', "{{%cms_user_universal_property}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_user_universal_property_updated_by', "{{%cms_user_universal_property}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function down()
{
$this->dropForeignKey("cms_user_universal_property_created_by", "{{%cms_user_universal_property}}");
$this->dropForeignKey("cms_user_universal_property_updated_by", "{{%cms_user_universal_property}}");
$this->dropTable("{{%cms_user_universal_property}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150512_103230_create_table__cms_content_element.php | src/migrations/v3/m150512_103230_create_table__cms_content_element.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 15.05.2015
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m150512_103230_create_table__cms_content_element
*/
class m150512_103230_create_table__cms_content_element extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_content_element}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content_element}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'published_at' => Schema::TYPE_INTEGER . ' NULL',
'published_to' => Schema::TYPE_INTEGER . ' NULL',
'priority' => Schema::TYPE_INTEGER. "(11) NOT NULL DEFAULT '500'",
'active' => "CHAR(1) NOT NULL DEFAULT 'Y'",
'name' => Schema::TYPE_STRING. '(255) NOT NULL',
'code' => Schema::TYPE_STRING. '(255) NULL',
'description_short' => Schema::TYPE_TEXT. ' NULL',
'description_full' => Schema::TYPE_TEXT. ' NULL',
'files' => Schema::TYPE_TEXT. ' NULL',
'content_id' => Schema::TYPE_INTEGER . ' NULL',
'tree_id' => Schema::TYPE_INTEGER . ' NULL',
'show_counter' => Schema::TYPE_INTEGER . ' NULL',
'show_counter_start' => Schema::TYPE_INTEGER . ' NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(published_at);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(published_to);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(code);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(active);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(content_id);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(tree_id);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD UNIQUE(content_id, code);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD UNIQUE(tree_id, code);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(show_counter);");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD INDEX(show_counter_start);");
$this->addForeignKey(
'cms_content_element_created_by', "{{%cms_content_element}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element_updated_by', "{{%cms_content_element}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element_tree_id', "{{%cms_content_element}}",
'tree_id', '{{%cms_tree}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element_content_id', "{{%cms_content_element}}",
'content_id', '{{%cms_content}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
$this->dropForeignKey("cms_content_element_created_by", "{{%cms_content_element}}");
$this->dropForeignKey("cms_content_element_updated_by", "{{%cms_content_element}}");
$this->dropForeignKey("cms_content_element_tree_id", "{{%cms_content_element}}");
$this->dropForeignKey("cms_content_element_content_id", "{{%cms_content_element}}");
$this->dropTable("{{%cms_content_element}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_163515__alter_table__cms_content_element_property.php | src/migrations/v3/m170701_163515__alter_table__cms_content_element_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170701_163515__alter_table__cms_content_element_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content_element_property}}", "value_num2", $this->decimal(18, 4));
$this->createIndex("value_num2", "{{%cms_content_element_property}}", "value_num2");
$this->addColumn("{{%cms_content_element_property}}", "value_int2", $this->integer());
$this->createIndex("value_int2", "{{%cms_content_element_property}}", "value_int2");
$this->addColumn("{{%cms_content_element_property}}", "value_string", $this->string(255));
$this->createIndex("value_string", "{{%cms_content_element_property}}", "value_string");
}
public function safeDown()
{
echo "m170701_163515__alter_table__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/v3/m150922_235320_update_data__cms_content_element.php | src/migrations/v3/m150922_235320_update_data__cms_content_element.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 30.07.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150922_235320_update_data__cms_content_element extends Migration
{
public function safeUp()
{
if ($models = \skeeks\cms\models\CmsContentElement::find()->all())
{
/**
* @var $model \skeeks\cms\models\CmsContentElement
*/
foreach ($models as $model)
{
if (!method_exists($model, 'getMainImageSrc'))
{
continue;
}
//$user->getFiles()
$imageSrc = $model->getMainImageSrcOld();
if ($imageSrc)
{
$storageFile = \skeeks\cms\models\CmsStorageFile::find()->where(['src' => $imageSrc])->one();
if ($storageFile)
{
$model->image_id = $storageFile->id;
$model->image_full_id = $storageFile->id;
$model->save(false);
}
}
}
}
}
public function down()
{
echo "m150922_235320_update_data__cms_content_element cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m171014_174515__alter_table__cms_user.php | src/migrations/v3/m171014_174515__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 m171014_174515__alter_table__cms_user extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_user}}", "first_name", $this->string(255));
$this->createIndex("first_name", "{{%cms_user}}", "first_name");
$this->addColumn("{{%cms_user}}", "last_name", $this->string(255));
$this->createIndex("last_name", "{{%cms_user}}", "last_name");
$this->addColumn("{{%cms_user}}", "patronymic", $this->string(255));
$this->createIndex("patronymic", "{{%cms_user}}", "patronymic");
$this->createIndex("full_name_index", "{{%cms_user}}", ["first_name", "last_name", "patronymic"]);
$this->renameColumn("{{%cms_user}}", "name", "_to_del_name");
}
public function safeDown()
{
echo "m171014_174515__alter_table__cms_user cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170508_023840__alter_table__cms_site_domain.php | src/migrations/v3/m170508_023840__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 m170508_023840__alter_table__cms_site_domain extends Migration
{
public function safeUp()
{
$this->dropForeignKey("cms_site_domain_site_code", "{{%cms_site_domain}}");
$this->dropColumn("{{%cms_site_domain}}", "site_code");
$this->dropForeignKey("cms_site_domain__cms_site_id", "{{%cms_site_domain}}");
$this->alterColumn("{{%cms_site_domain}}", "cms_site_id", $this->integer()->notNull());
$this->addForeignKey(
'cms_site_domain__cms_site_id', "{{%cms_site_domain}}",
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
echo "m170508_023840__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/v3/m170701_173515__alter_table__cms_tree_property.php | src/migrations/v3/m170701_173515__alter_table__cms_tree_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170701_173515__alter_table__cms_tree_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_tree_property}}", "value_num2", $this->decimal(18, 4));
$this->createIndex("value_num2", "{{%cms_tree_property}}", "value_num2");
$this->addColumn("{{%cms_tree_property}}", "value_int2", $this->integer());
$this->createIndex("value_int2", "{{%cms_tree_property}}", "value_int2");
$this->addColumn("{{%cms_tree_property}}", "value_string", $this->string(255));
$this->createIndex("value_string", "{{%cms_tree_property}}", "value_string");
}
public function safeDown()
{
echo "m170701_173515__alter_table__cms_tree_property cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m141109_100557_create_cms_infoblock_table.php | src/migrations/v3/m141109_100557_create_cms_infoblock_table.php | <?php
/**
* m141109_100557_create_cms_infoblock_table
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 09.11.2014
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m141109_100557_create_cms_infoblock_table
*/
class m141109_100557_create_cms_infoblock_table extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_infoblock}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable('{{%cms_infoblock}}', [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'name' => Schema::TYPE_STRING . '(255) NOT NULL',
'code' => Schema::TYPE_STRING . '(32) NULL',
'description' => Schema::TYPE_TEXT . ' NULL',
'widget' => Schema::TYPE_STRING . '(255) NULL', //widget class
'config' => Schema::TYPE_TEXT . ' NULL', //widget config in serialize
'rules' => Schema::TYPE_TEXT . ' NULL', //правила показа
'template' => Schema::TYPE_STRING . '(255) NULL', //шаблон виджета
'priority' => Schema::TYPE_INTEGER . ' NOT NULL DEFAULT 0', //шаблон виджета
'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10',
'files' => Schema::TYPE_TEXT. ' NULL', //
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_infoblock}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_infoblock}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_infoblock}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_infoblock}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_infoblock}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%cms_infoblock}} ADD INDEX(widget);");
$this->execute("ALTER TABLE {{%cms_infoblock}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_infoblock}} ADD INDEX(template);");
$this->execute("ALTER TABLE {{%cms_infoblock}} ADD UNIQUE(code);");
$this->execute("ALTER TABLE {{%cms_infoblock}} COMMENT = 'Инфоблоки';");
$this->addForeignKey(
'cms_infoblock_created_by', "{{%cms_infoblock}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_infoblock_updated_by', "{{%cms_infoblock}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
$this->dropForeignKey("cms_infoblock_updated_by", "{{%cms_infoblock}}");
$this->dropForeignKey("cms_infoblock_created_by", "{{%cms_infoblock}}");
$this->dropTable('{{%cms_infoblock}}');
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160216_093837__create_table__cms_dashboard_widget.php | src/migrations/v3/m160216_093837__create_table__cms_dashboard_widget.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 m160216_093837__create_table__cms_dashboard_widget extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_dashboard_widget}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_dashboard_widget}}", [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_dashboard_id' => $this->integer()->notNull(),
'cms_dashboard_column' => $this->integer()->notNull()->defaultValue(1),
'priority' => $this->integer()->notNull()->defaultValue(100),
'component' => $this->string(255)->notNull(),
'component_settings' => $this->text(),
], $tableOptions);
$this->createIndex('updated_by', '{{%cms_dashboard_widget}}', 'updated_by');
$this->createIndex('created_by', '{{%cms_dashboard_widget}}', 'created_by');
$this->createIndex('created_at', '{{%cms_dashboard_widget}}', 'created_at');
$this->createIndex('updated_at', '{{%cms_dashboard_widget}}', 'updated_at');
$this->createIndex('priority', '{{%cms_dashboard_widget}}', 'priority');
$this->createIndex('component', '{{%cms_dashboard_widget}}', 'component');
$this->createIndex('cms_dashboard_id', '{{%cms_dashboard_widget}}', 'cms_dashboard_id');
$this->createIndex('cms_dashboard_column', '{{%cms_dashboard_widget}}', 'cms_dashboard_column');
$this->execute("ALTER TABLE {{%cms_dashboard_widget}} COMMENT = 'Виджет рабочего стола';");
$this->addForeignKey(
'cms_dashboard_widget_created_by', "{{%cms_dashboard_widget}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_dashboard_widget_updated_by', "{{%cms_dashboard_widget}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_dashboard_widget__cms_dashboard_id', "{{%cms_dashboard_widget}}",
'cms_dashboard_id', '{{%cms_dashboard}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
$this->dropForeignKey("cms_dashboard_widget_updated_by", "{{%cms_dashboard_widget}}");
$this->dropForeignKey("cms_dashboard_widget_updated_by", "{{%cms_dashboard_widget}}");
$this->dropForeignKey("cms_dashboard_widget__cms_dashboard_id", "{{%cms_dashboard_widget}}");
$this->dropTable("{{%cms_dashboard_widget}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170507_103840__alter_table__cms_tree.php | src/migrations/v3/m170507_103840__alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170507_103840__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_tree}}", "cms_site_id", $this->integer());
$this->createIndex('cms_site_id', "{{%cms_tree}}", ['cms_site_id']);
$this->addForeignKey(
'cms_tree__cms_site_id', "{{%cms_tree}}",
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
$this->db->createCommand("UPDATE cms_tree JOIN cms_site ON cms_site.code = cms_tree.site_code SET cms_tree.cms_site_id = cms_site.id")->execute();
}
public function safeDown()
{
echo "m170507_103840__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150922_235520_alter_table__drop_files_column.php | src/migrations/v3/m150922_235520_alter_table__drop_files_column.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 30.07.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150922_235520_alter_table__drop_files_column extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_tree_type}} DROP `files`;");
$this->execute("ALTER TABLE {{%cms_content}} DROP `files`;");
}
public function down()
{
echo "m150922_235520_alter_table__drop_files_column cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170512_023840__alter_table__cms_content_element_property.php | src/migrations/v3/m170512_023840__alter_table__cms_content_element_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170512_023840__alter_table__cms_content_element_property extends Migration
{
public function safeUp()
{
$this->createIndex("property2element", "{{%cms_content_element_property}}", ["property_id", "element_id"]);
$this->createIndex("property2element2value_enum", "{{%cms_content_element_property}}", ["property_id", "element_id", "value_enum"]);
$this->createIndex("property2element2value_num", "{{%cms_content_element_property}}", ["property_id", "element_id", "value_num"]);
}
public function safeDown()
{
echo "m170512_023840__alter_table__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/v3/m150121_193200_create_table__cms_user_email.php | src/migrations/v3/m150121_193200_create_table__cms_user_email.php | <?php
/**
* m150121_193200_create_table__cms_user_email
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 21.01.2015
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m150121_193200_create_table__cms_user_email
*/
class m150121_193200_create_table__cms_user_email extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_user_email}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_user_email}}", [
'id' => Schema::TYPE_PK,
'user_id' => Schema::TYPE_INTEGER . ' NOT NULL',
'value' => Schema::TYPE_STRING. '(255) NOT NULL',
'approved' => Schema::TYPE_SMALLINT,
'approved_key' => Schema::TYPE_STRING. '(255)',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_user_email}} ADD INDEX(approved_key);");
$this->execute("ALTER TABLE {{%cms_user_email}} ADD INDEX(approved);");
$this->execute("ALTER TABLE {{%cms_user_email}} ADD INDEX(user_id);");
$this->execute("ALTER TABLE {{%cms_user_email}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_user_email}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_user_email}} ADD UNIQUE(value);");
$this->addForeignKey(
'cms_user_email_user_id', "{{%cms_user_email}}",
'user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function down()
{
$this->dropForeignKey("cms_user_email_user_id", "{{%cms_user_email}}");
$this->dropTable("{{%cms_user_email}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150520_153305_cms_alter_table__cms_lang.php | src/migrations/v3/m150520_153305_cms_alter_table__cms_lang.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 20.05.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150520_153305_cms_alter_table__cms_lang extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_lang}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_lang}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'active' => "CHAR(1) NOT NULL DEFAULT 'Y'",
'def' => "CHAR(1) NOT NULL DEFAULT 'N'",
'priority' => Schema::TYPE_INTEGER. "(11) NOT NULL DEFAULT '500'",
'code' => "CHAR(5) NOT NULL",
'name' => Schema::TYPE_STRING . '(255) NOT NULL',
'description' => Schema::TYPE_STRING . '(255) NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_lang}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_lang}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_lang}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_lang}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_lang}} ADD INDEX(def);");
$this->execute("ALTER TABLE {{%cms_lang}} ADD INDEX(code);");
$this->execute("ALTER TABLE {{%cms_lang}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_lang}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%cms_lang}} ADD INDEX(description);");
$this->execute("ALTER TABLE {{%cms_lang}} ADD UNIQUE(code);");
$this->execute("ALTER TABLE {{%cms_lang}} COMMENT = 'Доступные языки';");
$this->addForeignKey(
'cms_lang_created_by', "{{%cms_lang}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_lang_updated_by', "{{%cms_lang}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function down()
{
echo "m150520_153305_cms_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/v3/m141019_162721_subscribe_create_table.php | src/migrations/v3/m141019_162721_subscribe_create_table.php | <?php
/**
* m141019_162721_subscribe_create_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 m141019_162721_subscribe_create_table extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_subscribe}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_subscribe}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'linked_to_model' => Schema::TYPE_STRING. '(255) NOT NULL', //Коммент обязательно должен быть к кому то привязан
'linked_to_value' => Schema::TYPE_STRING. '(255) NOT NULL', //Коммент обязательно должен быть к кому то привязан
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_subscribe}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_subscribe}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_subscribe}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_subscribe}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_subscribe}} ADD INDEX(linked_to_model);");
$this->execute("ALTER TABLE {{%cms_subscribe}} ADD INDEX(linked_to_value);");
$this->execute("ALTER TABLE {{%cms_subscribe}} ADD UNIQUE(linked_to_model, linked_to_value, created_by);"); //на одну сущьность пользователь может подписаться 1 раз
$this->execute("ALTER TABLE {{%cms_subscribe}} COMMENT = 'Подписка или избранное';");
$this->addForeignKey(
'subscribe_created_by', "{{%cms_subscribe}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'subscribe_updated_by', "{{%cms_subscribe}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
$this->dropForeignKey("subscribe_created_by", "{{%cms_subscribe}}");
$this->dropForeignKey("subscribe_updated_by", "{{%cms_subscribe}}");
$this->dropTable("{{%cms_subscribe}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150922_233220_alter_table__cms_tree.php | src/migrations/v3/m150922_233220_alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 30.07.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150922_233220_alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_tree}} ADD `image_full_id` INT(11) NULL DEFAULT NULL AFTER `name`;");
$this->execute("ALTER TABLE {{%cms_tree}} ADD `image_id` INT(11) NULL DEFAULT NULL AFTER `name`;");
$this->createIndex('image_id', '{{%cms_tree}}', 'image_id');
$this->createIndex('image_full_id', '{{%cms_tree}}', 'image_full_id');
$this->addForeignKey(
'cms_tree__image_id', "{{%cms_tree}}",
'image_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_tree__image_full_id', "{{%cms_tree}}",
'image_full_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function down()
{
echo "m150922_233220_alter_table__cms_tree cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150512_153230_create_table__cms_content_element_property.php | src/migrations/v3/m150512_153230_create_table__cms_content_element_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 10.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150512_153230_create_table__cms_content_element_property extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_content_element_property}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content_element_property}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'property_id' => Schema::TYPE_INTEGER . ' NULL',
'element_id' => Schema::TYPE_INTEGER . ' NULL',
'value' => Schema::TYPE_STRING . '(255) NOT NULL',
'value_enum' => Schema::TYPE_INTEGER . '(11) NULL',
'value_num' => 'decimal(18,4) NULL',
'description' => Schema::TYPE_STRING . '(255) NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_content_element_property}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_content_element_property}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_content_element_property}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_content_element_property}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_content_element_property}} ADD INDEX(property_id);");
$this->execute("ALTER TABLE {{%cms_content_element_property}} ADD INDEX(element_id);");
$this->execute("ALTER TABLE {{%cms_content_element_property}} ADD INDEX(value);");
$this->execute("ALTER TABLE {{%cms_content_element_property}} ADD INDEX(value_enum);");
$this->execute("ALTER TABLE {{%cms_content_element_property}} ADD INDEX(value_num);");
$this->execute("ALTER TABLE {{%cms_content_element_property}} ADD INDEX(description);");
$this->execute("ALTER TABLE {{%cms_content_element_property}} COMMENT = 'Связь товара свойства и значения';");
$this->addForeignKey(
'cms_content_element_property_created_by', "{{%cms_content_element_property}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_content_element_property_updated_by', "{{%cms_content_element_property}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_content_element_property_element_id', "{{%cms_content_element_property}}",
'element_id', '{{%cms_content_element}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_content_element_property_property_id', "{{%cms_content_element_property}}",
'property_id', '{{%cms_content_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function down()
{
$this->dropForeignKey("cms_content_element_property_created_by", "{{%cms_content_element_property}}");
$this->dropForeignKey("cms_content_element_property_updated_by", "{{%cms_content_element_property}}");
$this->dropForeignKey("cms_content_element_property_element_id", "{{%cms_content_element_property}}");
$this->dropForeignKey("cms_content_element_property_property_id", "{{%cms_content_element_property}}");
$this->dropTable("{{%cms_content_element_property}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150528_114025_alter_table__cms_component_settings.php | src/migrations/v3/m150528_114025_alter_table__cms_component_settings.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150528_114025_alter_table__cms_component_settings extends Migration
{
public function safeUp()
{
//Возможны настройки для конкретного сайта
$this->execute("ALTER TABLE {{%cms_component_settings%}} ADD `site_code` CHAR(5) NULL;");
$this->execute("ALTER TABLE {{%cms_component_settings}} ADD INDEX(site_code);");
$this->addForeignKey(
'cms_component_settings_site_code', "{{%cms_component_settings}}",
'site_code', '{{%cms_site}}', 'code', 'CASCADE', 'CASCADE'
);
//Возможны настройки для конкретного пользователя
$this->execute("ALTER TABLE {{%cms_component_settings%}} ADD `user_id` integer(11) NULL;");
$this->execute("ALTER TABLE {{%cms_component_settings}} ADD INDEX(user_id);");
$this->addForeignKey(
'cms_component_settings_user_id', "{{%cms_component_settings}}",
'user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
//Возможны настройки для конкретного языка
$this->execute("ALTER TABLE {{%cms_component_settings%}} ADD `lang_code` CHAR(5) NULL;");
$this->execute("ALTER TABLE {{%cms_component_settings}} ADD INDEX(lang_code);");
$this->addForeignKey(
'cms_component_settings_lang_code', "{{%cms_component_settings}}",
'lang_code', '{{%cms_lang}}', 'code', 'CASCADE', 'CASCADE'
);
$this->execute("ALTER TABLE {{%cms_component_settings%}} ADD `namespace` VARCHAR (50) NULL;");
$this->execute("ALTER TABLE {{%cms_component_settings}} ADD INDEX(namespace);");
}
public function down()
{
echo "m150528_114025_alter_table__cms_component_settings cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160221_193220__alter_table__cms_tree.php | src/migrations/v3/m160221_193220__alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 21.02.2016
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\Json;
class m160221_193220__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->addColumn('{{%cms_tree}}', 'view_file', $this->string(128));
$this->createIndex('view_file', '{{%cms_tree}}', 'view_file');
}
public function safeDown()
{
$this->dropIndex('view_file', '{{%cms_tree}}');
$this->dropColumn('{{%cms_tree}}', 'view_file');
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150523_114025_alter_table__cms_tree.php | src/migrations/v3/m150523_114025_alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150523_114025_alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `type`;");
$this->execute("ALTER TABLE {{%cms_tree%}} ADD `tree_type_id` INT(11) NULL ;");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(tree_type_id);");
$this->addForeignKey(
'cms_tree_tree_type_id', "{{%cms_tree}}",
'tree_type_id', '{{%cms_tree_type}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function down()
{
echo "m150523_114025_alter_table__cms_tree cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150923_163220_create_table__cms_content_element_file.php | src/migrations/v3/m150923_163220_create_table__cms_content_element_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 m150923_163220_create_table__cms_content_element_file extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_content_element_file}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content_element_file}}", [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'storage_file_id' => $this->integer()->notNull(),
'content_element_id' => $this->integer()->notNull(),
'priority' => $this->integer()->notNull()->defaultValue(100),
], $tableOptions);
$this->createIndex('updated_by', '{{%cms_content_element_file}}', 'updated_by');
$this->createIndex('created_by', '{{%cms_content_element_file}}', 'created_by');
$this->createIndex('created_at', '{{%cms_content_element_file}}', 'created_at');
$this->createIndex('updated_at', '{{%cms_content_element_file}}', 'updated_at');
$this->createIndex('storage_file_id', '{{%cms_content_element_file}}', 'storage_file_id');
$this->createIndex('content_element_id', '{{%cms_content_element_file}}', 'content_element_id');
$this->createIndex('priority', '{{%cms_content_element_file}}', 'priority');
$this->createIndex('storage_file_id__content_element_id', '{{%cms_content_element_file}}', ['storage_file_id', 'content_element_id'], true);
$this->execute("ALTER TABLE {{%cms_content_element_file}} COMMENT = 'Связь элементов и файлов';");
$this->addForeignKey(
'cms_content_element_file_created_by', "{{%cms_content_element_file}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element_file_updated_by', "{{%cms_content_element_file}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element_file__storage_file_id', "{{%cms_content_element_file}}",
'storage_file_id', '{{%cms_storage_file}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_content_element_file__content_element_id', "{{%cms_content_element_file}}",
'content_element_id', '{{%cms_content_element}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
$this->dropForeignKey("cms_content_element_file_updated_by", "{{%cms_content_element_file}}");
$this->dropForeignKey("cms_content_element_file_updated_by", "{{%cms_content_element_file}}");
$this->dropForeignKey("cms_content_element_file__storage_file_id", "{{%cms_content_element_file}}");
$this->dropForeignKey("cms_content_element_file__content_element_id", "{{%cms_content_element_file}}");
$this->dropTable("{{%cms_content_element_file}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150528_114030_alter_table__cms_component_settings.php | src/migrations/v3/m150528_114030_alter_table__cms_component_settings.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150528_114030_alter_table__cms_component_settings extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE cms_component_settings DROP INDEX component_2;");
}
public function down()
{
echo "m150528_114030_alter_table__cms_component_settings cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170922_023840__alter_table__cms_content_element_property.php | src/migrations/v3/m170922_023840__alter_table__cms_content_element_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170922_023840__alter_table__cms_content_element_property extends Migration
{
public function safeUp()
{
$this->createIndex("property2element2value_string", "{{%cms_content_element_property}}", ["property_id", "element_id", "value_string"]);
}
public function safeDown()
{
echo "m170922_023840__alter_table__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/v3/m150806_213220_alter_table__cms_tree_type_property.php | src/migrations/v3/m150806_213220_alter_table__cms_tree_type_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 30.07.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150806_213220_alter_table__cms_tree_type_property extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_tree_type_property}} DROP INDEX `code`, ADD INDEX `code` (`code`) USING BTREE;");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD UNIQUE (code,tree_type_id);");
}
public function down()
{
echo "m150806_213220_alter_table__cms_tree_type_property cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150521_183315_alter_table__cms_tree.php | src/migrations/v3/m150521_183315_alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 21.05.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150521_183315_alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->dropForeignKey("pid_" .
"main_pid_cms_tree", "{{%cms_tree%}}");
//$this->execute("ALTER TABLE {{%cms_tree%}} DROP INDEX pid_main;");
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `pid_main`;");
}
public function down()
{
echo "m150521_183315_alter_table__cms_tree cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150826_133220_create_table__cms_user_property.php | src/migrations/v3/m150826_133220_create_table__cms_user_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 10.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150826_133220_create_table__cms_user_property extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_user_property}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_user_property}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'property_id' => Schema::TYPE_INTEGER . ' NULL',
'element_id' => Schema::TYPE_INTEGER . ' NULL',
'value' => Schema::TYPE_STRING . '(255) NOT NULL',
'value_enum' => Schema::TYPE_INTEGER . '(11) NULL',
'value_num' => 'decimal(18,4) NULL',
'description' => Schema::TYPE_STRING . '(255) NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_user_property}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_user_property}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_user_property}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_user_property}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_user_property}} ADD INDEX(property_id);");
$this->execute("ALTER TABLE {{%cms_user_property}} ADD INDEX(element_id);");
$this->execute("ALTER TABLE {{%cms_user_property}} ADD INDEX(value);");
$this->execute("ALTER TABLE {{%cms_user_property}} ADD INDEX(value_enum);");
$this->execute("ALTER TABLE {{%cms_user_property}} ADD INDEX(value_num);");
$this->execute("ALTER TABLE {{%cms_user_property}} ADD INDEX(description);");
$this->execute("ALTER TABLE {{%cms_user_property}} COMMENT = 'Связь свойства и значения';");
$this->addForeignKey(
'cms_user_property_created_by', "{{%cms_user_property}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_user_property_updated_by', "{{%cms_user_property}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_user_property_element_id', "{{%cms_user_property}}",
'element_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_user_property_property_id', "{{%cms_user_property}}",
'property_id', '{{%cms_user_universal_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function down()
{
$this->dropForeignKey("cms_user_property_created_by", "{{%cms_user_property}}");
$this->dropForeignKey("cms_user_property_updated_by", "{{%cms_user_property}}");
$this->dropForeignKey("cms_user_property_element_id", "{{%cms_user_property}}");
$this->dropForeignKey("cms_user_property_property_id", "{{%cms_user_property}}");
$this->dropTable("{{%cms_user_property}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_133357__alter_table__cms_content_property_enum.php | src/migrations/v3/m170701_133357__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\Schema;
use yii\db\Migration;
class m170701_133357__alter_table__cms_content_property_enum extends Migration
{
public function safeUp()
{
$this->dropForeignKey("cms_content_property_enum_created_by", "{{%cms_content_property_enum}}");
$this->dropForeignKey("cms_content_property_enum_updated_by", "{{%cms_content_property_enum}}");
$this->addForeignKey(
'cms_content_property_enum__created_by', "{{%cms_content_property_enum}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_property_enum__updated_by', "{{%cms_content_property_enum}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m170701_133355__alter_table__cms_content_element_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150521_193315_alter_table__cms_settings.php | src/migrations/v3/m150521_193315_alter_table__cms_settings.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 21.05.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150521_193315_alter_table__cms_settings extends Migration
{
public function safeUp()
{
$this->renameTable("cms_settings", "cms_component_settings");
}
public function down()
{
echo "m150521_193315_alter_table__cms_settings cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150523_103220_create_table__cms_tree_type.php | src/migrations/v3/m150523_103220_create_table__cms_tree_type.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 22.05.2015
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m150523_103220_create_table__cms_tree_type
*/
class m150523_103220_create_table__cms_tree_type extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_tree_type}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_tree_type}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'name' => Schema::TYPE_STRING. '(255) NOT NULL',
'code' => Schema::TYPE_STRING. '(50) NOT NULL',
'active' => "CHAR(1) NOT NULL DEFAULT 'Y'",
'priority' => Schema::TYPE_INTEGER. "(11) NOT NULL DEFAULT '500'",
'description' => Schema::TYPE_TEXT. " NULL",
'files' => Schema::TYPE_TEXT. ' NULL',
'index_for_search' => "CHAR(1) NOT NULL DEFAULT 'Y'", //Индексировать элементы для модуля поиска
'name_meny' => Schema::TYPE_STRING. '(100) NULL',
'name_one' => Schema::TYPE_STRING. '(100) NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_tree_type}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_tree_type}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_tree_type}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_tree_type}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_tree_type}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_tree_type}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%cms_tree_type}} ADD UNIQUE(code);");
$this->execute("ALTER TABLE {{%cms_tree_type}} ADD INDEX(active);");
$this->execute("ALTER TABLE {{%cms_tree_type}} ADD INDEX(index_for_search);");
$this->execute("ALTER TABLE {{%cms_tree_type}} ADD INDEX(name_meny);");
$this->execute("ALTER TABLE {{%cms_tree_type}} ADD INDEX(name_one);");
$this->execute("ALTER TABLE {{%cms_tree_type}} COMMENT = 'Тип раздела';");
$this->addForeignKey(
'cms_tree_type_created_by', "{{%cms_tree_type}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_tree_type_updated_by', "{{%cms_tree_type}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function down()
{
$this->dropForeignKey("cms_tree_type_created_by", "{{%cms_tree_type}}");
$this->dropForeignKey("cms_tree_type_updated_by", "{{%cms_tree_type}}");
$this->dropTable("{{%cms_tree_type}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170515_043840__alter_table__cms_user_universal_property.php | src/migrations/v3/m170515_043840__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\Schema;
use yii\db\Migration;
class m170515_043840__alter_table__cms_user_universal_property extends Migration
{
public function safeUp()
{
$this->dropColumn("{{%cms_user_universal_property}}", "multiple_cnt");
$this->dropColumn("{{%cms_user_universal_property}}", "with_description");
$this->dropColumn("{{%cms_user_universal_property}}", "searchable");
$this->dropColumn("{{%cms_user_universal_property}}", "filtrable");
$this->dropColumn("{{%cms_user_universal_property}}", "version");
$this->dropColumn("{{%cms_user_universal_property}}", "smart_filtrable");
}
public function safeDown()
{
echo "m170515_033840__alter_table__cms_user_universal_property cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160329_103837__alter_table__cms_user.php | src/migrations/v3/m160329_103837__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 m160329_103837__alter_table__cms_user extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_user}}", "email", $this->string(255)->unique());
$this->addColumn("{{%cms_user}}", "phone", $this->string(64)->unique());
$this->addColumn("{{%cms_user}}", "email_is_approved", $this->integer(1)->unsigned()->notNull()->defaultValue(0));
$this->addColumn("{{%cms_user}}", "phone_is_approved", $this->integer(1)->unsigned()->notNull()->defaultValue(0));
$this->createIndex("phone_is_approved", "{{%cms_user}}", "phone_is_approved");
$this->createIndex("email_is_approved", "{{%cms_user}}", "email_is_approved");
}
public function safeDown()
{
echo "m160329_103837__alter_table__cms_user cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150923_143220_create_table__cms_tree_file.php | src/migrations/v3/m150923_143220_create_table__cms_tree_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 m150923_143220_create_table__cms_tree_file extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_tree_file}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_tree_file}}", [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'storage_file_id' => $this->integer()->notNull(),
'tree_id' => $this->integer()->notNull(),
'priority' => $this->integer()->notNull()->defaultValue(100),
], $tableOptions);
$this->createIndex('updated_by', '{{%cms_tree_file}}', 'updated_by');
$this->createIndex('created_by', '{{%cms_tree_file}}', 'created_by');
$this->createIndex('created_at', '{{%cms_tree_file}}', 'created_at');
$this->createIndex('updated_at', '{{%cms_tree_file}}', 'updated_at');
$this->createIndex('storage_file_id', '{{%cms_tree_file}}', 'storage_file_id');
$this->createIndex('tree_id', '{{%cms_tree_file}}', 'tree_id');
$this->createIndex('priority', '{{%cms_tree_file}}', 'priority');
$this->createIndex('storage_file_id__tree_id', '{{%cms_tree_file}}', ['storage_file_id', 'tree_id'], true);
$this->execute("ALTER TABLE {{%cms_tree_file}} COMMENT = 'Связь разделов и файлов';");
$this->addForeignKey(
'cms_tree_file_created_by', "{{%cms_tree_file}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_tree_file_updated_by', "{{%cms_tree_file}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_tree_file__storage_file_id', "{{%cms_tree_file}}",
'storage_file_id', '{{%cms_storage_file}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_tree_file__tree_id', "{{%cms_tree_file}}",
'tree_id', '{{%cms_tree}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
$this->dropForeignKey("cms_tree_file_updated_by", "{{%cms_tree_file}}");
$this->dropForeignKey("cms_tree_file_updated_by", "{{%cms_tree_file}}");
$this->dropForeignKey("cms_tree_file__storage_file_id", "{{%cms_tree_file}}");
$this->dropForeignKey("cms_tree_file__tree_id", "{{%cms_tree_file}}");
$this->dropTable("{{%cms_tree_file}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150121_273203_alter_table__cms_user.php | src/migrations/v3/m150121_273203_alter_table__cms_user.php | <?php
/**
* m150121_273203_alter_table__cms_user
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 27.01.2015
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
class m150121_273203_alter_table__cms_user extends Migration
{
public function up()
{
\Yii::$app->db->getSchema()->refresh();
$userTable = \Yii::$app->db->getTableSchema('{{%cms_user}}');
if ($userTable->getColumn('count_vote'))
{
$this->dropColumn('{{%cms_user}}', 'count_vote');
}
if ($userTable->getColumn('result_vote'))
{
$this->dropColumn('{{%cms_user}}', 'result_vote');
}
if ($userTable->getColumn('users_votes_up'))
{
$this->dropColumn('{{%cms_user}}', 'users_votes_up');
}
if ($userTable->getColumn('users_votes_down'))
{
$this->dropColumn('{{%cms_user}}', 'users_votes_down');
}
if (!$userTable->getColumn('phone'))
{
$this->addColumn('{{%cms_user}}', 'phone', Schema::TYPE_STRING . '(255) NULL');
$this->execute("ALTER TABLE {{%cms_user}} ADD INDEX(phone);");
$this->execute("ALTER TABLE {{%cms_user}} ADD UNIQUE(phone);");
$this->execute("ALTER TABLE {{%cms_user}} ADD UNIQUE(email);");
}
}
public function down()
{
echo "m150121_273205_alter_table__cms_user__add_emails cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150516_103230_create_table__cms_content_element_tree.php | src/migrations/v3/m150516_103230_create_table__cms_content_element_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 10.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150516_103230_create_table__cms_content_element_tree extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_content_element_tree}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content_element_tree}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'element_id' => Schema::TYPE_INTEGER . ' NOT NULL',
'tree_id' => Schema::TYPE_INTEGER . ' NOT NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_content_element_tree}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_content_element_tree}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_content_element_tree}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_content_element_tree}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_content_element_tree}} ADD INDEX(tree_id);");
$this->execute("ALTER TABLE {{%cms_content_element_tree}} ADD INDEX(element_id);");
$this->execute("ALTER TABLE {{%cms_content_element_tree}} ADD UNIQUE(element_id, tree_id);");
$this->execute("ALTER TABLE {{%cms_content_element_tree}} COMMENT = 'Связь контента и разделов';");
$this->addForeignKey(
'cms_content_element_tree_created_by', "{{%cms_content_element_tree}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_content_element_tree_updated_by', "{{%cms_content_element_tree}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_content_element_tree_tree_id', "{{%cms_content_element_tree}}",
'tree_id', '{{%cms_tree}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_content_element_tree_element_id', "{{%cms_content_element_tree}}",
'element_id', '{{%cms_content_element}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function down()
{
$this->dropForeignKey("cms_content_element_tree_created_by", "{{%cms_content_element_tree}}");
$this->dropForeignKey("cms_content_element_tree_updated_by", "{{%cms_content_element_tree}}");
$this->dropForeignKey("cms_content_element_tree_tree_id", "{{%cms_content_element_tree}}");
$this->dropForeignKey("cms_content_element_tree_element_id", "{{%cms_content_element_tree}}");
$this->dropTable("{{%cms_content_element_tree}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150521_183310_alter_table__cms_tree.php | src/migrations/v3/m150521_183310_alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 21.05.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150521_183310_alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_tree%}} DROP `main_root`;");
}
public function down()
{
echo "m150521_183310_alter_table__cms_tree cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150923_173220_update_data__images_and_files.php | src/migrations/v3/m150923_173220_update_data__images_and_files.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\Json;
class m150923_173220_update_data__images_and_files extends Migration
{
public function safeUp()
{
$rows = (new \yii\db\Query())
->select(['id', 'files'])
->from('cms_tree')
->all();
if ($rows)
{
foreach ($rows as $row)
{
/**
* @var \skeeks\cms\models\CmsTree $model
*/
if (!$modelId = \yii\helpers\ArrayHelper::getValue($row, 'id'))
{
continue;
}
if (!$model = \skeeks\cms\models\CmsTree::findOne($modelId))
{
continue;
}
$files = \yii\helpers\ArrayHelper::getValue($row, 'files');
if (!$files)
{
continue;
}
$files = Json::decode($files);
if ($images = \yii\helpers\ArrayHelper::getValue($files, 'images'))
{
foreach ($images as $src)
{
$storageFile = \skeeks\cms\models\StorageFile::find()->where(['src' => $src])->one();
if ($storageFile)
{
if ( !$model->getCmsTreeImages()->andWhere(['storage_file_id' => $storageFile->id])->one() )
{
$model->link('images', $storageFile);
}
}
}
}
if ($files = \yii\helpers\ArrayHelper::getValue($files, 'files'))
{
foreach ($files as $src)
{
$storageFile = \skeeks\cms\models\StorageFile::find()->where(['src' => $src])->one();
if ($storageFile)
{
if ( !$model->getCmsTreeFiles()->andWhere(['storage_file_id' => $storageFile->id])->one() )
{
$model->link('files', $storageFile);
}
}
}
}
}
}
$rows = (new \yii\db\Query())
->select(['id', 'files'])
->from('cms_content_element')
->all();
if ($rows)
{
foreach ($rows as $row)
{
/**
* @var \skeeks\cms\models\CmsContentElement $model
*/
if (!$modelId = \yii\helpers\ArrayHelper::getValue($row, 'id'))
{
continue;
}
if (!$model = \skeeks\cms\models\CmsContentElement::findOne($modelId))
{
continue;
}
$files = \yii\helpers\ArrayHelper::getValue($row, 'files');
if (!$files)
{
continue;
}
$files = Json::decode($files);
if ($images = \yii\helpers\ArrayHelper::getValue($files, 'images'))
{
foreach ($images as $src)
{
$storageFile = \skeeks\cms\models\StorageFile::find()->where(['src' => $src])->one();
if ($storageFile)
{
if ( !$model->getCmsContentElementImages()->andWhere(['storage_file_id' => $storageFile->id])->one() )
{
$model->link('images', $storageFile);
}
}
}
}
if ($files = \yii\helpers\ArrayHelper::getValue($files, 'files'))
{
foreach ($files as $src)
{
$storageFile = \skeeks\cms\models\StorageFile::find()->where(['src' => $src])->one();
if ($storageFile)
{
if ( !$model->getCmsContentElementFiles()->andWhere(['storage_file_id' => $storageFile->id])->one() )
{
$model->link('files', $storageFile);
}
}
}
}
}
}
}
public function safeDown()
{
echo "m150923_173220_update_data__images_and_files cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_133349__alter_table__cms_content_element_property.php | src/migrations/v3/m170701_133349__alter_table__cms_content_element_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170701_133349__alter_table__cms_content_element_property extends Migration
{
public function safeUp()
{
$this->dropForeignKey("cms_content_element_property_created_by", "{{%cms_content_element_property}}");
$this->dropForeignKey("cms_content_element_property_updated_by", "{{%cms_content_element_property}}");
$this->addForeignKey(
'cms_content_element_property__created_by', "{{%cms_content_element_property}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element_property__updated_by', "{{%cms_content_element_property}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m170701_133349__alter_table__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/v3/m150827_133220_create_table__cms_search_phrase.php | src/migrations/v3/m150827_133220_create_table__cms_search_phrase.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 m150827_133220_create_table__cms_search_phrase extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_search_phrase}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_search_phrase}}", [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'phrase' => $this->string(255),
'result_count' => $this->integer()->notNull()->defaultValue(0),
'pages' => $this->integer()->notNull()->defaultValue(0),
'ip' => $this->string(32),
'session_id' => $this->string(32),
'site_code' => "CHAR(15) NULL",
'data_server' => $this->text(),
'data_session' => $this->text(),
'data_cookie' => $this->text(),
'data_request' => $this->text(),
], $tableOptions);
$this->createIndex('updated_by', '{{%cms_search_phrase}}', 'updated_by');
$this->createIndex('created_by', '{{%cms_search_phrase}}', 'created_by');
$this->createIndex('created_at', '{{%cms_search_phrase}}', 'created_at');
$this->createIndex('updated_at', '{{%cms_search_phrase}}', 'updated_at');
$this->createIndex('phrase', '{{%cms_search_phrase}}', 'phrase');
$this->createIndex('result_count', '{{%cms_search_phrase}}', 'result_count');
$this->createIndex('pages', '{{%cms_search_phrase}}', 'pages');
$this->createIndex('ip', '{{%cms_search_phrase}}', 'ip');
$this->createIndex('session_id', '{{%cms_search_phrase}}', 'session_id');
$this->createIndex('site_code', '{{%cms_search_phrase}}', 'site_code');
$this->execute("ALTER TABLE {{%cms_search_phrase}} COMMENT = 'Поисковые фразы';");
$this->addForeignKey(
'cms_search_phrase_created_by', "{{%cms_search_phrase}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_search_phrase_updated_by', "{{%cms_search_phrase}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_search_phrase_site_code_fk', "{{%cms_search_phrase}}",
'site_code', '{{%cms_site}}', 'code', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
$this->dropForeignKey("cms_search_phrase_updated_by", "{{%cms_search_phrase}}");
$this->dropForeignKey("cms_search_phrase_updated_by", "{{%cms_search_phrase}}");
$this->dropForeignKey("cms_search_phrase_site_code_fk", "{{%cms_search_phrase}}");
$this->dropTable("{{%cms_search_phrase}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160222_203220__alter_table__cms_content.php | src/migrations/v3/m160222_203220__alter_table__cms_content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 21.02.2016
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\Json;
class m160222_203220__alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->addColumn('{{%cms_content}}', 'visible', $this->string(1)->notNull()->defaultValue("Y"));
$this->createIndex('visible', '{{%cms_content}}', 'visible');
$this->addColumn('{{%cms_content}}', 'parent_content_on_delete', $this->string(10)->notNull()->defaultValue("CASCADE"));
$this->createIndex('parent_content_on_delete', '{{%cms_content}}', 'parent_content_on_delete');
$this->addColumn('{{%cms_content}}', 'parent_content_is_required', $this->string(1)->notNull()->defaultValue("Y"));
$this->createIndex('parent_content_is_required', '{{%cms_content}}', 'parent_content_is_required');
}
public function safeDown()
{
$this->dropIndex('visible', '{{%cms_content}}');
$this->dropColumn('{{%cms_content}}', 'visible');
$this->dropIndex('parent_content_on_delete', '{{%cms_content}}');
$this->dropColumn('{{%cms_content}}', 'parent_content_on_delete');
$this->dropIndex('parent_content_is_required', '{{%cms_content}}');
$this->dropColumn('{{%cms_content}}', 'parent_content_is_required');
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m151023_163220_alter_table__cms_content.php | src/migrations/v3/m151023_163220_alter_table__cms_content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\Json;
class m151023_163220_alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->addColumn('{{%cms_content}}', 'viewFile', $this->string(255));
$this->createIndex('viewFile', '{{%cms_content}}', 'viewFile');
}
public function safeDown()
{
echo "m151023_153220_alter_table__cms_content cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150324_273210_alter_table__cms_infoblock_2.php | src/migrations/v3/m150324_273210_alter_table__cms_infoblock_2.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150324_273210_alter_table__cms_infoblock_2 extends Migration
{
public function up()
{
$this->execute("ALTER TABLE {{%cms_infoblock%}} ADD `protected_widget_params` TEXT NULL;");
}
public function down()
{
echo "m150324_273210_alter_table__cms_infoblock_2 cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150520_173310_create_table__cms_site_domain.php | src/migrations/v3/m150520_173310_create_table__cms_site_domain.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150520_173310_create_table__cms_site_domain extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_site_domain}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_site_domain}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'site_code' => "CHAR(5) NOT NULL",
'domain' => Schema::TYPE_STRING . '(255) NOT NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_site_domain}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_site_domain}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_site_domain}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_site_domain}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_site_domain}} ADD UNIQUE(domain, site_code);");
$this->execute("ALTER TABLE {{%cms_site_domain}} COMMENT = 'Доменные имена сайтов';");
$this->addForeignKey(
'cms_site_domain_created_by', "{{%cms_site_domain}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_site_domain_updated_by', "{{%cms_site_domain}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_site_domain_site_code', "{{%cms_site_domain}}",
'site_code', '{{%cms_site}}', 'code', 'CASCADE', 'CASCADE'
);
}
public function down()
{
echo "m150520_173310_create_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/v3/m151023_113220_alter_table__cms_site.php | src/migrations/v3/m151023_113220_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;
use yii\helpers\Json;
class m151023_113220_alter_table__cms_site extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE `cms_site` DROP FOREIGN KEY cms_site_lang_code;");
$this->execute("ALTER TABLE `cms_site` DROP `lang_code`;");
}
public function safeDown()
{
echo "m150924_193220_alter_table__cms_user_email cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150512_103210_create_table__cms_content_type.php | src/migrations/v3/m150512_103210_create_table__cms_content_type.php | <?php
/**
* m150121_273200_create_table__cms_content_type
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 27.01.2015
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m150512_103210_create_table__cms_content_type
*/
class m150512_103210_create_table__cms_content_type extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_content_type}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content_type}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'files' => Schema::TYPE_TEXT. ' NULL',
'priority' => Schema::TYPE_INTEGER. "(11) NOT NULL DEFAULT '500'",
'name' => Schema::TYPE_STRING. '(255) NOT NULL',
'code' => Schema::TYPE_STRING. '(32) NOT NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_content_type}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_content_type}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_content_type}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_content_type}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_content_type}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_content_type}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%cms_content_type}} ADD UNIQUE(code);");
$this->addForeignKey(
'cms_content_type_created_by', "{{%cms_content_type}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_type_updated_by', "{{%cms_content_type}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function down()
{
$this->dropForeignKey("cms_content_type_created_by", "{{%cms_content_type}}");
$this->dropForeignKey("cms_content_type_updated_by", "{{%cms_content_type}}");
$this->dropTable("{{%cms_content_type}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_174515__alter_table__cms_user_property.php | src/migrations/v3/m170701_174515__alter_table__cms_user_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170701_174515__alter_table__cms_user_property extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_user_property}}", "value_num2", $this->decimal(18, 4));
$this->createIndex("value_num2", "{{%cms_user_property}}", "value_num2");
$this->addColumn("{{%cms_user_property}}", "value_int2", $this->integer());
$this->createIndex("value_int2", "{{%cms_user_property}}", "value_int2");
$this->addColumn("{{%cms_user_property}}", "value_string", $this->string(255));
$this->createIndex("value_string", "{{%cms_user_property}}", "value_string");
}
public function safeDown()
{
echo "m170701_173515__alter_table__cms_user_property cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150923_153220_create_table__cms_content_element_image.php | src/migrations/v3/m150923_153220_create_table__cms_content_element_image.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 m150923_153220_create_table__cms_content_element_image extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_content_element_image}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content_element_image}}", [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'storage_file_id' => $this->integer()->notNull(),
'content_element_id' => $this->integer()->notNull(),
'priority' => $this->integer()->notNull()->defaultValue(100),
], $tableOptions);
$this->createIndex('updated_by', '{{%cms_content_element_image}}', 'updated_by');
$this->createIndex('created_by', '{{%cms_content_element_image}}', 'created_by');
$this->createIndex('created_at', '{{%cms_content_element_image}}', 'created_at');
$this->createIndex('updated_at', '{{%cms_content_element_image}}', 'updated_at');
$this->createIndex('storage_file_id', '{{%cms_content_element_image}}', 'storage_file_id');
$this->createIndex('content_element_id', '{{%cms_content_element_image}}', 'content_element_id');
$this->createIndex('priority', '{{%cms_content_element_image}}', 'priority');
$this->createIndex('storage_file_id__content_element_id', '{{%cms_content_element_image}}', ['storage_file_id', 'content_element_id'], true);
$this->execute("ALTER TABLE {{%cms_content_element_image}} COMMENT = 'Связь элементов и файлов изображений';");
$this->addForeignKey(
'cms_content_element_image_created_by', "{{%cms_content_element_image}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element_image_updated_by', "{{%cms_content_element_image}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element_image__storage_file_id', "{{%cms_content_element_image}}",
'storage_file_id', '{{%cms_storage_file}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_content_element_image__content_element_id', "{{%cms_content_element_image}}",
'content_element_id', '{{%cms_content_element}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
$this->dropForeignKey("cms_content_element_image_updated_by", "{{%cms_content_element_image}}");
$this->dropForeignKey("cms_content_element_image_updated_by", "{{%cms_content_element_image}}");
$this->dropForeignKey("cms_content_element_image__storage_file_id", "{{%cms_content_element_image}}");
$this->dropForeignKey("cms_content_element_image__content_element_id", "{{%cms_content_element_image}}");
$this->dropTable("{{%cms_content_element_image}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170416_103837__alter_table__cms_tree.php | src/migrations/v3/m170416_103837__alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170416_103837__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->dropColumn("{{%cms_tree}}", "tree_menu_ids");
$this->dropColumn("{{%cms_tree}}", "has_children");
}
public function safeDown()
{
echo "m170416_103837__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m140814_223103_create_user_authclient_table.php | src/migrations/v3/m140814_223103_create_user_authclient_table.php | <?php
/**
* Создание таблицы где будут храниться профили авторизации через соц сети.
* И их связи с юзерами
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 15.10.2014
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m140814_223103_create_user_authclient_table
*/
class m140814_223103_create_user_authclient_table extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_user_authclient}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_user_authclient}}", [
'id' => Schema::TYPE_PK,
'user_id' => Schema::TYPE_INTEGER . ' NOT NULL',
'provider' => Schema::TYPE_STRING. '(50)',
'provider_identifier' => Schema::TYPE_STRING. '(100)',
'provider_data' => Schema::TYPE_TEXT,
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_user_authclient}} ADD INDEX(user_id);");
$this->execute("ALTER TABLE {{%cms_user_authclient}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_user_authclient}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_user_authclient}} ADD INDEX(provider);");
$this->execute("ALTER TABLE {{%cms_user_authclient}} ADD INDEX(provider_identifier);");
$this->addForeignKey(
'fk_user_id', "{{%cms_user_authclient}}",
'user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function down()
{
$this->dropForeignKey("fk_user_id", "{{%cms_user_authclient}}");
$this->dropTable("{{%cms_user_authclient}}");
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150519_103210_drop_tables_social.php | src/migrations/v3/m150519_103210_drop_tables_social.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 19.05.2015
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m190515_103210_drop_tables_social
*/
class m150519_103210_drop_tables_social extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_vote}}", true);
if ($tableExist)
{
$this->execute("DROP TABLE {{%cms_vote}}");
}
$tableExist = $this->db->getTableSchema("{{%cms_comment}}", true);
if ($tableExist)
{
$this->execute("DROP TABLE {{%cms_comment}}");
}
$tableExist = $this->db->getTableSchema("{{%cms_static_block}}", true);
if ($tableExist)
{
$this->execute("DROP TABLE {{%cms_static_block}}");
}
$tableExist = $this->db->getTableSchema("{{%cms_subscribe}}", true);
if ($tableExist)
{
$this->execute("DROP TABLE {{%cms_subscribe}}");
}
}
public function down()
{
echo "m150519_103210_drop_tables_social cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150922_235220_alter_table__cms_content_element.php | src/migrations/v3/m150922_235220_alter_table__cms_content_element.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 30.07.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150922_235220_alter_table__cms_content_element extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_content_element}} ADD `image_full_id` INT(11) NULL DEFAULT NULL AFTER `name`;");
$this->execute("ALTER TABLE {{%cms_content_element}} ADD `image_id` INT(11) NULL DEFAULT NULL AFTER `name`;");
$this->createIndex('image_id', '{{%cms_content_element}}', 'image_id');
$this->createIndex('image_full_id', '{{%cms_content_element}}', 'image_full_id');
$this->addForeignKey(
'cms_content_element__image_id', "{{%cms_content_element}}",
'image_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_element__image_full_id', "{{%cms_content_element}}",
'image_full_id', '{{%cms_storage_file}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function down()
{
echo "m150922_235220_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/v3/m150512_113230_create_table__cms_content_property.php | src/migrations/v3/m150512_113230_create_table__cms_content_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 10.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150512_113230_create_table__cms_content_property extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_content_property}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content_property}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'name' => Schema::TYPE_STRING . '(255) NOT NULL',
'code' => Schema::TYPE_STRING . '(64) NULL',
'content_id' => Schema::TYPE_INTEGER . ' NULL',
'active' => "CHAR(1) NOT NULL DEFAULT 'Y'",
'priority' => "INT NOT NULL DEFAULT '500'",
'property_type' => "CHAR(1) NOT NULL DEFAULT 'S'",
'list_type' => "CHAR(1) NOT NULL DEFAULT 'L'",
'multiple' => "CHAR(1) NOT NULL DEFAULT 'N'",
'multiple_cnt' => "INT NULL",
'with_description' => "CHAR(1) NULL",
'searchable' => "CHAR(1) NOT NULL DEFAULT 'N'",
'filtrable' => "CHAR(1) NOT NULL DEFAULT 'N'",
'is_required' => "CHAR(1) NULL",
'version' => "INT NOT NULL DEFAULT '1'",
'component' => "VARCHAR(255) NULL",
'component_settings' => "TEXT NULL",
'hint' => "VARCHAR(255) NULL",
'smart_filtrable' => "CHAR(1) NOT NULL DEFAULT 'N'",
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD UNIQUE(code);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(content_id);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(active);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(property_type);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(list_type);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(multiple);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(multiple_cnt);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(with_description);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(searchable);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(filtrable);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(is_required);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(version);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(component);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(hint);");
$this->execute("ALTER TABLE {{%cms_content_property}} ADD INDEX(smart_filtrable);");
$this->execute("ALTER TABLE {{%cms_content_property}} COMMENT = 'Свойства элементов';");
$this->addForeignKey(
'cms_content_property_created_by', "{{%cms_content_property}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_content_property_updated_by', "{{%cms_content_property}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_content_property_content_id', "{{%cms_content_property}}",
'content_id', '{{%cms_content}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
$this->dropForeignKey("cms_content_property_created_by", "{{%cms_content_property}}");
$this->dropForeignKey("cms_content_property_updated_by", "{{%cms_content_property}}");
$this->dropForeignKey("cms_content_property_content_id", "{{%cms_content_property}}");
$this->dropTable("{{%cms_content_property}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150715_103220_create_table__cms_agent.php | src/migrations/v3/m150715_103220_create_table__cms_agent.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 m150715_103220_create_table__cms_agent extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_agent}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_agent}}", [
'id' => Schema::TYPE_PK,
'last_exec_at' => Schema::TYPE_INTEGER . ' NULL',
'next_exec_at' => Schema::TYPE_INTEGER . ' NOT NULL',
'name' => Schema::TYPE_TEXT . " NOT NULL",
'description' => Schema::TYPE_TEXT . " NULL",
'agent_interval' => Schema::TYPE_INTEGER . " NOT NULL DEFAULT '86400'",
'priority' => Schema::TYPE_INTEGER . " NOT NULL DEFAULT '100'",
'active' => "CHAR(1) NOT NULL DEFAULT 'Y'",
'is_period' => "CHAR(1) NOT NULL DEFAULT 'Y'",
'is_running' => "CHAR(1) NOT NULL DEFAULT 'N'",
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_agent}} ADD INDEX(last_exec_at);");
$this->execute("ALTER TABLE {{%cms_agent}} ADD INDEX(next_exec_at);");
$this->execute("ALTER TABLE {{%cms_agent}} ADD INDEX(agent_interval);");
$this->execute("ALTER TABLE {{%cms_agent}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_agent}} ADD INDEX(active);");
$this->execute("ALTER TABLE {{%cms_agent}} ADD INDEX(is_period);");
$this->execute("ALTER TABLE {{%cms_agent}} ADD INDEX(is_running);");
$this->execute("ALTER TABLE {{%cms_agent}} COMMENT = 'Агенты';");
}
public function safeDown()
{
$this->dropTable('{{%cms_agent}}');
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150826_123220_create_table__cms_user_universal_property_enum.php | src/migrations/v3/m150826_123220_create_table__cms_user_universal_property_enum.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 10.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150826_123220_create_table__cms_user_universal_property_enum extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_user_universal_property_enum}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_user_universal_property_enum}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'property_id' => Schema::TYPE_INTEGER . ' NULL',
'value' => Schema::TYPE_STRING . '(255) NOT NULL',
'def' => "CHAR(1) NOT NULL DEFAULT 'N'",
'code' => Schema::TYPE_STRING. '(32) NOT NULL',
'priority' => Schema::TYPE_INTEGER. "(11) NOT NULL DEFAULT '500'",
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_user_universal_property_enum}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_user_universal_property_enum}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_user_universal_property_enum}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_user_universal_property_enum}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_user_universal_property_enum}} ADD INDEX(property_id);");
$this->execute("ALTER TABLE {{%cms_user_universal_property_enum}} ADD INDEX(def);");
$this->execute("ALTER TABLE {{%cms_user_universal_property_enum}} ADD INDEX(code);");
$this->execute("ALTER TABLE {{%cms_user_universal_property_enum}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_user_universal_property_enum}} ADD INDEX(value);");
$this->execute("ALTER TABLE {{%cms_user_universal_property_enum}} COMMENT = 'Справочник значений свойств типа список';");
$this->addForeignKey(
'cms_user_universal_property_enum_created_by', "{{%cms_user_universal_property_enum}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_user_universal_property_enum_updated_by', "{{%cms_user_universal_property_enum}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_user_universal_property_enum_property_id', "{{%cms_user_universal_property_enum}}",
'property_id', '{{%cms_user_universal_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function down()
{
$this->dropForeignKey("cms_user_universal_property_enum_created_by", "{{%cms_user_universal_property_enum}}");
$this->dropForeignKey("cms_user_universal_property_enum_updated_by", "{{%cms_user_universal_property_enum}}");
$this->dropForeignKey("cms_user_universal_property_enum_property_id", "{{%cms_user_universal_property_enum}}");
$this->dropTable("{{%cms_user_universal_property_enum}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160222_193220__alter_table__cms_content.php | src/migrations/v3/m160222_193220__alter_table__cms_content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 21.02.2016
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\Json;
class m160222_193220__alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->addColumn('{{%cms_content}}', 'parent_content_id', $this->integer());
$this->createIndex('parent_content_id', '{{%cms_content}}', 'parent_content_id');
$this->addForeignKey(
'cms_content__cms_content', "{{%cms_content}}",
'parent_content_id', '{{%cms_content}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addColumn('{{%cms_content_element}}', 'parent_content_element_id', $this->integer());
$this->createIndex('parent_content_element_id', '{{%cms_content_element}}', 'parent_content_element_id');
$this->addForeignKey(
'cms_content_element__cms_content_element', "{{%cms_content_element}}",
'parent_content_element_id', '{{%cms_content_element}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
$this->dropForeignKey("cms_content_element__cms_content_element", "{{%cms_content_element}}");
$this->dropForeignKey("cms_content__cms_content", "{{%cms_content}}");
$this->dropIndex('parent_content_id', '{{%cms_content}}');
$this->dropIndex('parent_content_element_id', '{{%cms_content_element}}');
$this->dropColumn('{{%cms_content}}', 'parent_content_id');
$this->dropColumn('{{%cms_content_element}}', 'parent_content_element_id');
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160329_113837__update_data__cms_user.php | src/migrations/v3/m160329_113837__update_data__cms_user.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\ArrayHelper;
class m160329_113837__update_data__cms_user extends Migration
{
public function safeUp()
{
try
{
$data = \Yii::$app->db->createCommand('SELECT * FROM `cms_user_email`')->queryAll();
if ($data)
{
foreach ($data as $row)
{
if (ArrayHelper::getValue($row, 'value') && ArrayHelper::getValue($row, 'user_id') && (int) ArrayHelper::getValue($row, 'user_id') > 0)
{
\Yii::$app->db->createCommand()->update('cms_user', [
'email' => ArrayHelper::getValue($row, 'value')
], [
'id' => ArrayHelper::getValue($row, 'user_id')
])->execute();
}
}
}
$data = \Yii::$app->db->createCommand('SELECT * FROM `cms_user_phone`')->queryAll();
if ($data)
{
foreach ($data as $row)
{
if (ArrayHelper::getValue($row, 'value') && ArrayHelper::getValue($row, 'user_id') && (int) ArrayHelper::getValue($row, 'user_id') > 0)
{
\Yii::$app->db->createCommand()->update('cms_user', [
'phone' => ArrayHelper::getValue($row, 'value')
], [
'id' => ArrayHelper::getValue($row, 'user_id')
])->execute();
}
}
}
return true;
} catch(\Exception $e)
{
return false;
}
}
public function safeDown()
{
echo "m160329_103837__alter_table__cms_user cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170515_203837__create_table__cms_content_property2tree.php | src/migrations/v3/m170515_203837__create_table__cms_content_property2tree.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 m170515_203837__create_table__cms_content_property2tree extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_content_property2tree}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_content_property2tree}}", [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_content_property_id' => $this->integer()->notNull(),
'cms_tree_id' => $this->integer()->notNull(),
], $tableOptions);
$this->createIndex('updated_by', '{{%cms_content_property2tree}}', 'updated_by');
$this->createIndex('created_by', '{{%cms_content_property2tree}}', 'created_by');
$this->createIndex('created_at', '{{%cms_content_property2tree}}', 'created_at');
$this->createIndex('updated_at', '{{%cms_content_property2tree}}', 'updated_at');
$this->createIndex('cms_content_property_id', '{{%cms_content_property2tree}}', 'cms_content_property_id');
$this->createIndex('cms_tree_id', '{{%cms_content_property2tree}}', 'cms_tree_id');
$this->createIndex('property2tree', '{{%cms_content_property2tree}}', ['cms_content_property_id', 'cms_tree_id'], true);
$this->addForeignKey(
'cms_content_property2tree__created_by', "{{%cms_content_property2tree}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_property2tree__updated_by', "{{%cms_content_property2tree}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_content_property2tree__cms_tree_id', "{{%cms_content_property2tree}}",
'cms_tree_id', '{{%cms_tree}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_content_property2tree__property_id', "{{%cms_content_property2tree}}",
'cms_content_property_id', '{{%cms_content_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
$this->dropForeignKey("cms_content_property2tree__created_by", "{{%cms_content_property2tree}}");
$this->dropForeignKey("cms_content_property2tree__updated_by", "{{%cms_content_property2tree}}");
$this->dropForeignKey("cms_content_property2tree__property_id", "{{%cms_content_property2tree}}");
$this->dropForeignKey("cms_content_property2tree__content_id", "{{%cms_content_property2tree}}");
$this->dropTable("{{%cms_content_property2tree}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160320_103837__alter_table__cms_user.php | src/migrations/v3/m160320_103837__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 m160320_103837__alter_table__cms_user extends Migration
{
public function safeUp()
{
//m220319_103837__alter_table__cms_user
if ($this->db->createCommand('SELECT * FROM migration WHERE version="m220319_103837__alter_table__cms_user"')->queryOne())
{
$this->db->createCommand()->delete('migration', 'version = "m220319_103837__alter_table__cms_user"')->execute();
return true;
}
$this->dropIndex("city", "{{%cms_user}}");
$this->dropIndex("address", "{{%cms_user}}");
$this->dropColumn("{{%cms_user}}", "city");
$this->dropColumn("{{%cms_user}}", "address");
$this->dropColumn("{{%cms_user}}", "info");
$this->dropColumn("{{%cms_user}}", "files");
$this->dropColumn("{{%cms_user}}", "status_of_life");
}
public function safeDown()
{
echo "m220319_103837__alter_table__cms_user cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150730_213220_create_table__cms_event.php | src/migrations/v3/m150730_213220_create_table__cms_event.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 30.07.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150730_213220_create_table__cms_event extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_event}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_event}}", [
'id' => Schema::TYPE_PK,
'event_name' => Schema::TYPE_STRING . '(255) NOT NULL',
'name' => Schema::TYPE_STRING . '(100) NULL',
'description' => Schema::TYPE_TEXT . ' NULL',
'priority' => Schema::TYPE_INTEGER. "(11) NOT NULL DEFAULT '150'",
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_event}} ADD UNIQUE (event_name);");
$this->execute("ALTER TABLE {{%cms_event}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_event}} ADD INDEX(name);");
}
public function safeDown()
{
$this->dropTable('{{%cms_event}}');
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150604_114030_alter_table__cms_user.php | src/migrations/v3/m150604_114030_alter_table__cms_user.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150604_114030_alter_table__cms_user extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_user}} ADD `updated_by` INT NULL ;");
$this->execute("ALTER TABLE {{%cms_user}} ADD `created_by` INT NULL ;");
$this->execute("ALTER TABLE {{%cms_user}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_user}} ADD INDEX(created_by);");
$this->addForeignKey(
'cms_user_created_by', "{{%cms_user}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_user_updated_by', "{{%cms_user}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function down()
{
echo "m150604_114030_alter_table__cms_user cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170507_123840__alter_table__cms_tree.php | src/migrations/v3/m170507_123840__alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170507_123840__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->alterColumn("{{%cms_tree}}", 'dir', $this->string(500));
$this->createIndex("cms_tree__site_dir", "{{%cms_tree}}", ['dir', 'cms_site_id']);
}
public function safeDown()
{
echo "m170507_103840__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150622_114030_alter_table__cms_user.php | src/migrations/v3/m150622_114030_alter_table__cms_user.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150622_114030_alter_table__cms_user extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_user}} ADD `logged_at` INT NULL ;");
$this->execute("ALTER TABLE {{%cms_user}} ADD INDEX(logged_at);");
}
public function down()
{
echo "m150622_114030_alter_table__cms_user cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170622_053840__alter_table__add_column_bool_value.php | src/migrations/v3/m170622_053840__alter_table__add_column_bool_value.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 m170622_053840__alter_table__add_column_bool_value extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_content_element_property}}", "value_bool", $this->boolean());
$this->addColumn("{{%cms_tree_property}}", "value_bool", $this->boolean());
$this->addColumn("{{%cms_user_property}}", "value_bool", $this->boolean());
}
public function safeDown()
{
echo "m170622_053840__alter_table__add_bool_value cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m151030_183220_alter_table__cms_tree.php | src/migrations/v3/m151030_183220_alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\Json;
class m151030_183220_alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->addColumn('{{%cms_tree}}', 'redirect_code', $this->integer() . " NOT NULL DEFAULT 301");
$this->createIndex('redirect_code', '{{%cms_tree}}', 'redirect_code');
}
public function safeDown()
{
echo "m151030_183220_alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170416_103840__alter_table__cms_tree.php | src/migrations/v3/m170416_103840__alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170416_103840__alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->dropForeignKey('cms_tree_created_by', "{{%cms_tree}}");
$this->dropForeignKey('cms_tree_updated_by', "{{%cms_tree}}");
$this->addForeignKey(
'cms_tree__created_by', "{{%cms_tree}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_tree__updated_by', "{{%cms_tree}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m170416_103837__alter_table__cms_tree cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150523_103520_create_table__cms_tree_type_property.php | src/migrations/v3/m150523_103520_create_table__cms_tree_type_property.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 10.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150523_103520_create_table__cms_tree_type_property extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_tree_type_property}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_tree_type_property}}", [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'name' => Schema::TYPE_STRING . '(255) NOT NULL',
'code' => Schema::TYPE_STRING . '(64) NULL',
'active' => "CHAR(1) NOT NULL DEFAULT 'Y'",
'priority' => "INT NOT NULL DEFAULT '500'",
'property_type' => "CHAR(1) NOT NULL DEFAULT 'S'",
'list_type' => "CHAR(1) NOT NULL DEFAULT 'L'",
'multiple' => "CHAR(1) NOT NULL DEFAULT 'N'",
'multiple_cnt' => "INT NULL",
'with_description' => "CHAR(1) NULL",
'searchable' => "CHAR(1) NOT NULL DEFAULT 'N'",
'filtrable' => "CHAR(1) NOT NULL DEFAULT 'N'",
'is_required' => "CHAR(1) NULL",
'version' => "INT NOT NULL DEFAULT '1'",
'component' => "VARCHAR(255) NULL",
'component_settings' => "TEXT NULL",
'hint' => "VARCHAR(255) NULL",
'smart_filtrable' => "CHAR(1) NOT NULL DEFAULT 'N'",
'tree_type_id' => Schema::TYPE_INTEGER . ' NULL',
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(name);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD UNIQUE(code);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(active);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(priority);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(property_type);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(list_type);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(multiple);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(multiple_cnt);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(with_description);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(searchable);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(filtrable);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(is_required);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(version);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(component);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(hint);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(smart_filtrable);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} ADD INDEX(tree_type_id);");
$this->execute("ALTER TABLE {{%cms_tree_type_property}} COMMENT = 'Свойство раздела';");
$this->addForeignKey(
'cms_tree_type_property_created_by', "{{%cms_tree_type_property}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_tree_type_property_updated_by', "{{%cms_tree_type_property}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_tree_type_property_tree_type_id', "{{%cms_tree_type_property}}",
'tree_type_id', '{{%cms_tree_type}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
$this->dropForeignKey("cms_tree_type_property_created_by", "{{%cms_tree_type_property}}");
$this->dropForeignKey("cms_tree_type_property_updated_by", "{{%cms_tree_type_property}}");
$this->dropForeignKey("cms_tree_type_property_tree_type_id", "{{%cms_tree_type_property}}");
$this->dropTable("{{%cms_tree_type_property}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170515_093837__create_table__cms_tree_type_property2type.php | src/migrations/v3/m170515_093837__create_table__cms_tree_type_property2type.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 m170515_093837__create_table__cms_tree_type_property2type extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_tree_type_property2type}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_tree_type_property2type}}", [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'cms_tree_type_property_id' => $this->integer()->notNull(),
'cms_tree_type_id' => $this->integer()->notNull(),
], $tableOptions);
$this->createIndex('updated_by', '{{%cms_tree_type_property2type}}', 'updated_by');
$this->createIndex('created_by', '{{%cms_tree_type_property2type}}', 'created_by');
$this->createIndex('created_at', '{{%cms_tree_type_property2type}}', 'created_at');
$this->createIndex('updated_at', '{{%cms_tree_type_property2type}}', 'updated_at');
$this->createIndex('cms_tree_type_property_id', '{{%cms_tree_type_property2type}}', 'cms_tree_type_property_id');
$this->createIndex('cms_tree_type_id', '{{%cms_tree_type_property2type}}', 'cms_tree_type_id');
$this->createIndex('property2content', '{{%cms_tree_type_property2type}}', ['cms_tree_type_property_id', 'cms_tree_type_id'], true);
$this->addForeignKey(
'cms_tree_type_property2type__created_by', "{{%cms_tree_type_property2type}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_tree_type_property2type__updated_by', "{{%cms_tree_type_property2type}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_tree_type_property2type__type_id', "{{%cms_tree_type_property2type}}",
'cms_tree_type_id', '{{%cms_tree_type}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_tree_type_property2type__property_id', "{{%cms_tree_type_property2type}}",
'cms_tree_type_property_id', '{{%cms_tree_type_property}}', 'id', 'CASCADE', 'CASCADE'
);
}
public function safeDown()
{
$this->dropForeignKey("cms_tree_type_property2type__created_by", "{{%cms_tree_type_property2type}}");
$this->dropForeignKey("cms_tree_type_property2type__updated_by", "{{%cms_tree_type_property2type}}");
$this->dropForeignKey("cms_tree_type_property2type__property_id", "{{%cms_tree_type_property2type}}");
$this->dropForeignKey("cms_tree_type_property2type__type_id", "{{%cms_tree_type_property2type}}");
$this->dropTable("{{%cms_tree_type_property2type}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m141111_100557_alter_tables_tree_and_publication.php | src/migrations/v3/m141111_100557_alter_tables_tree_and_publication.php | <?php
/**
* Добавляем типы публикаций и страниц
* m141111_100557_alter_tables_tree_and_publication
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 11.11.2014
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
class m141111_100557_alter_tables_tree_and_publication extends Migration
{
public function up()
{
$this->addColumn('{{%cms_publication}}', 'type', Schema::TYPE_STRING . '(32) NULL');
$this->addColumn('{{%cms_publication}}', 'tree_ids', Schema::TYPE_STRING . '(500) NULL');
$this->addColumn('{{%cms_tree}}', 'type', Schema::TYPE_STRING . '(32) NULL');
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(type);");
$this->execute("ALTER TABLE {{%cms_publication}} ADD INDEX(tree_ids);");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(type);");
$this->execute(<<<SQL
INSERT INTO `cms_tree` (`id`, `created_by`, `updated_by`, `created_at`, `updated_at`, `name`, `description_short`, `description_full`, `files`, `page_options`, `seo_page_name`, `count_comment`, `count_subscribe`, `users_subscribers`, `count_vote`, `result_vote`, `users_votes_up`, `users_votes_down`, `status`, `status_adult`, `pid`, `pid_main`, `pids`, `level`, `dir`, `has_children`, `main_root`, `priority`, `type`) VALUES
(1, 1, 1, 1416084922, 1416839464, 'Главная страница', '', '', '', '{"_":{"meta_title":{"value":"Главная страница по умолчанию"},"meta_keywords":{"value":"Главная страница по умолчанию"},"meta_description":{"value":"Главная страница по умолчанию"}}}', NULL, NULL, NULL, NULL, NULL, NULL, '', '', 10, 0, NULL, NULL, '', 0, NULL, 1, 1, 0, 'homePage');
SQL
);
}
public function down()
{
$this->dropColumn('{{%cms_publication}}', 'type');
$this->dropColumn('{{%cms_publication}}', 'tree_ids');
$this->dropColumn('{{%cms_tree}}', 'type');
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170701_133501__alter_table__cms_tree_type_property_enum.php | src/migrations/v3/m170701_133501__alter_table__cms_tree_type_property_enum.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m170701_133501__alter_table__cms_tree_type_property_enum extends Migration
{
public function safeUp()
{
$this->dropForeignKey("cms_tree_type_property_enum_created_by", "{{%cms_tree_type_property_enum}}");
$this->dropForeignKey("cms_tree_type_property_enum_updated_by", "{{%cms_tree_type_property_enum}}");
$this->addForeignKey(
'cms_tree_type_property_enum__created_by', "{{%cms_tree_type_property_enum}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_tree_type_property_enum__updated_by', "{{%cms_tree_type_property_enum}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
echo "m170701_133501__alter_table__cms_tree_type_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/v3/m150924_183220_alter_table__cms_user.php | src/migrations/v3/m150924_183220_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;
use yii\helpers\Json;
class m150924_183220_alter_table__cms_user extends Migration
{
public function safeUp()
{
$schema = $this->db->getSchema()->getTableSchema('cms_user', true);
foreach ($schema->foreignKeys as $fkData)
{
if ($fkData[0] == 'cms_user_phone')
{
$this->dropForeignKey('cms_user_tree_cms_user_phone', 'cms_user');
}
if ($fkData[0] == 'cms_user_email')
{
$this->dropForeignKey('cms_user_tree_cms_user_email', 'cms_user');
}
}
$this->dropColumn('cms_user', 'email');
$this->dropColumn('cms_user', 'phone');
}
public function safeDown()
{
echo "m150924_183220_alter_table__cms_user cannot be reverted.\n";
return false;
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m170508_013840__alter_table__cms_site_domain.php | src/migrations/v3/m170508_013840__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 m170508_013840__alter_table__cms_site_domain extends Migration
{
public function safeUp()
{
$this->addColumn("{{%cms_site_domain}}", "cms_site_id", $this->integer());
$this->createIndex('cms_site_id', "{{%cms_site_domain}}", ['cms_site_id']);
$this->addForeignKey(
'cms_site_domain__cms_site_id', "{{%cms_site_domain}}",
'cms_site_id', '{{%cms_site}}', 'id', 'CASCADE', 'CASCADE'
);
$this->db->createCommand("UPDATE cms_site_domain JOIN cms_site ON cms_site.code = cms_site_domain.site_code SET cms_site_domain.cms_site_id = cms_site.id")->execute();
//$this->alterColumn("{{%cms_site_domain}}", "cms_site_id", $this->integer()->notNull());
}
public function safeDown()
{
echo "m170508_013840__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/v3/m150520_163310_insert_cms_site_and_lang.php | src/migrations/v3/m150520_163310_insert_cms_site_and_lang.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150520_163310_insert_cms_site_and_lang extends Migration
{
public function safeUp()
{
$this->execute(<<<SQL
INSERT INTO `cms_lang` (`id`, `created_by`, `updated_by`, `created_at`, `updated_at`, `active`, `def`, `priority`, `code`, `name`, `description`) VALUES
(1, 1, 1, 1432126580, 1432130752, 'Y', 'Y', 500, 'ru', 'Русский', ''),
(2, 1, 1, 1432126667, 1432130744, 'N', 'N', 600, 'en', 'Английский', '');
SQL
);
$this->execute(<<<SQL
INSERT INTO `cms_site` (`id`, `created_by`, `updated_by`, `created_at`, `updated_at`, `active`, `def`, `priority`, `code`, `lang_code`, `name`, `server_name`, `description`) VALUES
(1, 1, 1, 1432128290, 1432130861, 'Y', 'Y', 500, 's1', 'ru', 'Сайт 1', '', '');
SQL
);
}
public function down()
{
echo "m150520_163310_insert_cms_site_and_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/v3/m141116_100557_create_teable_static_block.php | src/migrations/v3/m141116_100557_create_teable_static_block.php | <?php
/**
* m141116_100557_create_teable_static_block
*
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010-2014 SkeekS (Sx)
* @date 16.11.2014
* @since 1.0.0
*/
use yii\db\Schema;
use yii\db\Migration;
/**
* Class m141109_100557_create_cms_static_block_table
*/
class m141116_100557_create_teable_static_block extends Migration
{
public function up()
{
$tableExist = $this->db->getTableSchema("{{%cms_static_block}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable('{{%cms_static_block}}', [
'id' => Schema::TYPE_PK,
'created_by' => Schema::TYPE_INTEGER . ' NULL',
'updated_by' => Schema::TYPE_INTEGER . ' NULL',
'created_at' => Schema::TYPE_INTEGER . ' NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NULL',
'code' => Schema::TYPE_STRING . '(32) NOT NULL',
'description' => Schema::TYPE_TEXT . ' NULL',
'value' => Schema::TYPE_TEXT . ' NULL',
'files' => Schema::TYPE_TEXT. ' NULL', //
], $tableOptions);
$this->execute("ALTER TABLE {{%cms_static_block}} ADD INDEX(created_at);");
$this->execute("ALTER TABLE {{%cms_static_block}} ADD INDEX(updated_at);");
$this->execute("ALTER TABLE {{%cms_static_block}} ADD INDEX(created_by);");
$this->execute("ALTER TABLE {{%cms_static_block}} ADD INDEX(updated_by);");
$this->execute("ALTER TABLE {{%cms_static_block}} ADD UNIQUE(code);");
$this->execute("ALTER TABLE {{%cms_static_block}} COMMENT = 'Статические блоки';");
$this->addForeignKey(
'cms_static_block_created_by', "{{%cms_static_block}}",
'created_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
$this->addForeignKey(
'cms_static_block_updated_by', "{{%cms_static_block}}",
'updated_by', '{{%cms_user}}', 'id', 'RESTRICT', 'RESTRICT'
);
}
public function down()
{
$this->dropForeignKey("cms_static_block_updated_by", "{{%cms_static_block}}");
$this->dropForeignKey("cms_static_block_created_by", "{{%cms_static_block}}");
$this->dropTable('{{%cms_static_block}}');
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150520_183310_alter_table__cms_tree.php | src/migrations/v3/m150520_183310_alter_table__cms_tree.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 24.03.2015
*/
use yii\db\Schema;
use yii\db\Migration;
class m150520_183310_alter_table__cms_tree extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_tree%}} ADD `site_code` CHAR(5) NULL;");
$this->execute("ALTER TABLE {{%cms_tree}} ADD INDEX(site_code);");
$this->addForeignKey(
'cms_tree_site_code', "{{%cms_tree}}",
'site_code', '{{%cms_site}}', 'code', 'CASCADE', 'CASCADE'
);
$this->execute("UPDATE {{%cms_tree}} SET `site_code` = 's1'");
$this->execute("ALTER TABLE {{%cms_tree}} CHANGE `site_code` `site_code` CHAR(5) NOT NULL;");
}
public function down()
{
echo "m150520_183310_alter_table__cms_tree cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160215_093837__create_table__cms_dashboard.php | src/migrations/v3/m160215_093837__create_table__cms_dashboard.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 m160215_093837__create_table__cms_dashboard extends Migration
{
public function safeUp()
{
$tableExist = $this->db->getTableSchema("{{%cms_dashboard}}", true);
if ($tableExist)
{
return true;
}
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable("{{%cms_dashboard}}", [
'id' => $this->primaryKey(),
'created_by' => $this->integer(),
'updated_by' => $this->integer(),
'created_at' => $this->integer(),
'updated_at' => $this->integer(),
'name' => $this->string(255)->notNull(),
'cms_user_id' => $this->integer(),
'priority' => $this->integer()->notNull()->defaultValue(100),
'columns' => $this->integer()->notNull()->unsigned()->defaultValue(1),
'columns_settings' => $this->text(),
], $tableOptions);
$this->createIndex('updated_by', '{{%cms_dashboard}}', 'updated_by');
$this->createIndex('created_by', '{{%cms_dashboard}}', 'created_by');
$this->createIndex('created_at', '{{%cms_dashboard}}', 'created_at');
$this->createIndex('updated_at', '{{%cms_dashboard}}', 'updated_at');
$this->createIndex('name', '{{%cms_dashboard}}', 'name');
$this->createIndex('cms_user_id', '{{%cms_dashboard}}', 'cms_user_id');
$this->createIndex('priority', '{{%cms_dashboard}}', 'priority');
$this->createIndex('columns', '{{%cms_dashboard}}', 'columns');
$this->execute("ALTER TABLE {{%cms_dashboard}} COMMENT = 'Рабочий стол';");
$this->addForeignKey(
'cms_dashboard_created_by', "{{%cms_dashboard}}",
'created_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
$this->addForeignKey(
'cms_dashboard__cms_user_id', "{{%cms_dashboard}}",
'cms_user_id', '{{%cms_user}}', 'id', 'CASCADE', 'CASCADE'
);
$this->addForeignKey(
'cms_dashboard_updated_by', "{{%cms_dashboard}}",
'updated_by', '{{%cms_user}}', 'id', 'SET NULL', 'SET NULL'
);
}
public function safeDown()
{
$this->dropForeignKey("cms_dashboard_updated_by", "{{%cms_dashboard}}");
$this->dropForeignKey("cms_dashboard_updated_by", "{{%cms_dashboard}}");
$this->dropForeignKey("cms_dashboard__cms_user_id", "{{%cms_dashboard}}");
$this->dropTable("{{%cms_dashboard}}");
}
} | php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m150520_103210_cms_alter_user_data.php | src/migrations/v3/m150520_103210_cms_alter_user_data.php | <?php
use yii\db\Schema;
use yii\db\Migration;
class m150520_103210_cms_alter_user_data extends Migration
{
public function safeUp()
{
$this->execute("ALTER TABLE {{%cms_user%}} DROP `role`;");
$this->execute("ALTER TABLE {{%cms_user%}} DROP `status`;");
$this->execute("ALTER TABLE {{%cms_user%}} DROP `count_subscribe`;");
$this->execute("ALTER TABLE {{%cms_user%}} DROP `users_subscribers`;");
$this->execute("ALTER TABLE {{%cms_user%}} DROP `count_comment`;");
$this->execute("ALTER TABLE {{%cms_user%}} ADD `active` CHAR(1) NOT NULL DEFAULT 'Y' ;");
}
public function down()
{
echo "m150520_103210_cms_alter_user_data cannot be reverted.\n";
return false;
}
}
| php | BSD-3-Clause | c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf | 2026-01-05T04:50:22.405425Z | false |
skeeks-cms/cms | https://github.com/skeeks-cms/cms/blob/c22dc84c6fc4da5f67815a3339bc10c6c4aa39cf/src/migrations/v3/m160413_103837__alter_table__cms_content_element.php | src/migrations/v3/m160413_103837__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 m160413_103837__alter_table__cms_content_element extends Migration
{
public function safeUp()
{
$this->dropColumn("{{%cms_content_element}}", "files_depricated");
$this->dropColumn("{{%cms_tree}}", "files_depricated");
}
public function safeDown()
{
echo "m160413_103837__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/v3/m170515_023840__alter_table__cms_content_property.php | src/migrations/v3/m170515_023840__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 m170515_023840__alter_table__cms_content_property extends Migration
{
public function safeUp()
{
$this->dropColumn("{{%cms_content_property}}", "multiple_cnt");
$this->dropColumn("{{%cms_content_property}}", "with_description");
$this->dropColumn("{{%cms_content_property}}", "searchable");
$this->dropColumn("{{%cms_content_property}}", "filtrable");
$this->dropColumn("{{%cms_content_property}}", "version");
$this->dropColumn("{{%cms_content_property}}", "smart_filtrable");
}
public function safeDown()
{
echo "m170512_023840__alter_table__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/v3/m151110_193220_alter_table__cms_content.php | src/migrations/v3/m151110_193220_alter_table__cms_content.php | <?php
/**
* @author Semenov Alexander <semenov@skeeks.com>
* @link http://skeeks.com/
* @copyright 2010 SkeekS (СкикС)
* @date 28.08.2015
*/
use yii\db\Schema;
use yii\db\Migration;
use yii\helpers\Json;
class m151110_193220_alter_table__cms_content extends Migration
{
public function safeUp()
{
$this->addColumn('{{%cms_content}}', 'meta_title_template', $this->string(500));
$this->addColumn('{{%cms_content}}', 'meta_description_template', $this->text());
$this->addColumn('{{%cms_content}}', 'meta_keywords_template', $this->text());
}
public function safeDown()
{
echo "m151110_193220_alter_table__cms_content 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.