andreyryabin / sprint.migration
Bitrix 迁移模块
Requires
- php: >=7.4
- ext-json: *
- composer/installers: ~1
- dev-master
- 4.13.1
- 4.12.6
- 4.11.4
- 4.10.4
- 4.9.9
- 4.8.2
- 4.7.1
- 4.6.2
- 4.4.1
- 4.3.2
- 4.2.5
- 4.1.3
- 4.0.6
- 3.30.1
- 3.29.5
- 3.28.8
- 3.27.1
- 3.26.1
- 3.25.1
- 3.24.1
- 3.23.4
- 3.22.4
- 3.21.4
- 3.20.4
- 3.19.1
- 3.18.1
- 3.17.3
- 3.16.3
- 3.15.1
- 3.14.6
- 3.13.5
- 3.12.19
- 3.11.1
- 3.10.2
- 3.9.3
- 3.8.6
- 3.7.3
- 3.6.9
- 3.5.6
- 3.4.7
- 3.3.8
- 3.2.1
- 3.1.3
- 3.0.9
- 2.8.9
- 2.7.5
- 2.6.2
- 2.5.8
- 2.4.5
- 2.3.9
- 2.2.9
- dev-release-4.9.1
- dev-release-4.7
- dev-release-4.1.1
- dev-release-4.1.0
- dev-medialib
- dev-release-3.15.1
This package is auto-updated.
Last update: 2024-09-05 07:29:20 UTC
README
帮助在不同项目副本之间迁移更改。
所有数据库更改都写入迁移文件,这些文件以及整个项目代码都存储在版本控制系统中(例如 git),然后它们被发送到开发人员的副本。之后,他们需要执行新的迁移安装以更新数据库。
可以通过控制台或后台管理操作。
- 市场: http://marketplace.1c-bitrix.ru/solutions/sprint.migration/
- Composer: https://packagist.org.cn/packages/andreyryabin/sprint.migration
- 文档: https://github.com/andreyryabin/sprint.migration/wiki
- 资料: https://dev.1c-bitrix.ru/community/webdev/user/39653/blog/
- Telegram 群组: https://t.me/sprint_migration_bitrix
特别感谢
以及所有助手!
https://github.com/andreyryabin/sprint.migration/blob/master/contributors.txt
通过 composer 安装
您的 composer.json 示例,将模块安装在 local/modules/
{
"extra": {
"installer-paths": {
"local/modules/{$name}/": ["type:bitrix-module"]
}
},
"require": {
"andreyryabin/sprint.migration": "dev-master"
},
}
控制台
使用 /bitrix/modules/sprint.migration/tools/migrate.php
脚本通过控制台工作
可以直接运行它或创建别名,在项目根目录创建 bin/migrate
文件,并写入以下内容:
#!/usr/bin/env php
<?php
$_SERVER['DOCUMENT_ROOT'] = dirname(__DIR__);
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/sprint.migration/tools/migrate.php';
symfony 控制台
如果您使用 bitrix + symfony,则可以将模块作为 symfoni 包接入,并通过以下方式运行模块的命令行命令:
php bin/console sprint:migration
注册包的示例
// app/AppKernel.php
use Sprint\Migration\SymfonyBundle\SprintMigrationBundle;
public function registerBundles()
{
$bundles = array(
new SprintMigrationBundle(),
);
return $bundles;
}
不注册包的示例,只包含在 symfony/console 中的命令
// bin/console
use Sprint\Migration\SymfonyBundle\Command\ConsoleCommand;
use Symfony\Component\Console\Application;
$app = new Application();
$app->add(new ConsoleCommand());
$app->run();
模块类应已经自动加载,通过 CModule::IncludeModule('sprint.migration')
或通过库 https://packagist.org.cn/packages/webarchitect609/bitrix-neverinclude(推荐此选项)
命令示例
- php bin/migrate add(创建新的迁移)
- php bin/migrate ls(显示迁移列表)
- php bin/migrate up(应用所有迁移)
- php bin/migrate up [version](应用指定版本的迁移)
- php bin/migrate down(回滚所有迁移)
- php bin/migrate down [version](回滚指定版本的迁移)
所有命令: https://github.com/andreyryabin/sprint.migration/blob/master/commands.txt