这里就是我坚持:的Symfony和学说迁移
我打电话是执行学说迁移的API,使用最新版本。
它运行一个命令。
当我执行手动这里的命令是输出(工作完成): ==配置
>> Name: Application Migrations
>> Database Driver: pdo_sqlsrv
>> Database Name: xxxxxxxxxx
>> Configuration Source: manually configured
>> Version Table Name: Dsys_migration_versions
>> Version Column Name: version
>> Migrations Namespace: Application\Migrations
>> Migrations Directory: /var/www/xxxx/app/DoctrineMigrations
>> Previous Version: (20170503101946CreateSettingTable)
>> Current Version: (20170621150818CreateCalculatedfieldQuery)
>> Next Version: Already at latest version
>> Latest Version: (20170621150818CreateCalculatedfieldQuery)
>> Executed Migrations: 19
>> Executed Unavailable Migrations: 0
>> Available Migrations: 19
>> New Migrations: 0
==可用的迁移版本
>> (20170307111115CreateCustomTableTable) migrated
>> (20170307111322CreateCustomFieldTable) migrated
>> (20170307111324CreatePresetFieldTable) migrated
>> (20170307111326CreateDimensionTable) migrated
>> (20170307111328CreateCustomFieldChoiceTable) migrated
>> (20170307111329CreateImportScheduleTable) migrated
>> (20170307111331CreateMappedFieldTable) migrated
>> (20170307111332CreateImportTaskTable) migrated
>> (20170307111334CreateSegmentationQueryTable) migrated
>> (20170307111335CreateSegmentationQueryJoinTable) migrated
>> (20170307111336CreateCalculatedFieldSettingTable) migrated
>> (20170307111338CreateBlacklistTable) migrated
>> (20170307151829CreateCalculatedFieldFilterTable) migrated
>> (20170315105949CreateImportTable) migrated
>> (20170403134126CreateFamilyTable) migrated
>> (20170410124309CreateUserTable) migrated
>> (20170412103331CreateCalculatedFieldJoinTable) migrated
>> (20170503101946CreateSettingTable) migrated
>> (20170621150818CreateCalculatedfieldQuery) migrated
当我调用API那运行命令(似乎遵循完全相同的路径)(JOB NOT DONE):
==配置
>> Name: Application Migrations
>> Database Driver: pdo_sqlsrv
>> Database Name: xxxxxxxxxxxx
>> Configuration Source: manually configured
>> Version Table Name: Dsys_migration_versions
>> Version Column Name: version
>> Migrations Namespace: Application\Migrations
>> Migrations Directory: /var/www/xxxxxx/app/DoctrineMigrations
>> Previous Version: Already at first version
>> Current Version: 0
>> Next Version: (20170307111115CreateCustomTableTable)
>> Latest Version: (20170621150818CreateCalculatedfieldQuery)
>> Executed Migrations: 0
>> Executed Unavailable Migrations: 0
>> Available Migrations: 19
>> New Migrations: 19
==可用的迁移版本
>> (20170307111115CreateCustomTableTable) not migrated
>> (20170307111322CreateCustomFieldTable) not migrated
>> (20170307111324CreatePresetFieldTable) not migrated
>> (20170307111326CreateDimensionTable) not migrated
>> (20170307111328CreateCustomFieldChoiceTable) not migrated
>> (20170307111329CreateImportScheduleTable) not migrated
>> (20170307111331CreateMappedFieldTable) not migrated
>> (20170307111332CreateImportTaskTable) not migrated
>> (20170307111334CreateSegmentationQueryTable) not migrated
>> (20170307111335CreateSegmentationQueryJoinTable) not migrated
>> (20170307111336CreateCalculatedFieldSettingTable) not migrated
>> (20170307111338CreateBlacklistTable) not migrated
>> (20170307151829CreateCalculatedFieldFilterTable) not migrated
>> (20170315105949CreateImportTable) not migrated
>> (20170403134126CreateFamilyTable) not migrated
>> (20170410124309CreateUserTable) not migrated
>> (20170412103331CreateCalculatedFieldJoinTable) not migrated
>> (20170503101946CreateSettingTable) not migrated
>> (20170621150818CreateCalculatedfieldQuery) not migrated
我可以通过仓/控制台教义执行等待迁移:迁移:迁移命令。我不知道为什么这项工作没有完成。
这里是最后的函数调用学说:迁移:迁移:
private function migrateDatabase(OutputInterface $output, string $version = 'latest')
{
$command = $this->getApplication()->find('doctrine:migrations:migrate');
$arguments = ['version' => $version];
$inputCommand = new ArrayInput($arguments);
$inputCommand->setInteractive(false);
if ($command->run($inputCommand, $output) !== 0) {
$output->writeln('<error>Fail : errors in database migrations.</error>');
}
}
如果我转储$输出,同时调用API它prompte:没有迁移aviailable。当明显地构造一个主义:迁移:状态输出19迁移正在等待...
另外,你必须知道,这个该死的东西,适用于某个目标数据库,但失败时,我瞄准别人。我绝对不能说出区别,因为他们是彼此的复制和过去......这就是为什么我需要调试,我可以忽略它,只是把它看作是一个随机错误,但当这件事情上线时,我不想要一个不好的惊喜。
[编辑] 它的getMigrationsToExecute($方向,$到),在我调试的情况下返回空,开始查找原因。如果你有任何线索。
任何帮助,将不胜感激,
感谢您的阅读。
从api和控制台输出'数据库名称'是否相同? Doctrine使用表(migration_versions)来存储已执行的迁移。 – Mcsky
是的,它是一样的...我已经setInteractive为false,所以这不是理论上的提示。 另外,我已经有了在api调用中正确创建的存储过程,因此它确认了DB是正确的。 – Culdz
你能告诉我们在你的api上执行最新教条迁移的代码部分吗? – Mcsky