여기에 제가 붙어 있습니다 :Symfony & Doctrine Migration
나는 최신 버전을 사용하여 교리 마이 그 레이션을 실행하는 API를 호출하고 있습니다.
명령을 실행합니다.
I 여기에 직접 명령을 출력 (작업이 완료)는 실행시 : == 구성
>> 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
== 가능한 이전 버전 I의 API를 호출
>> (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
그 명령을 실행합니다 (정확하게 동일한 경로를 따르는 것 같습니다) (완료하지 않음) :
== 구성
>> 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>');
}
}
을가 prompte API를 호출하는 동안 내가 $ 출력을 덤프 경우 : 없음 마이그레이션 aviailable. 분명히 교리를 강요 할 때 : 이주 : 상태 출력 19migrations 기다리고 있습니다 ...
플러스, 당신은이 망할 것을 알고 있어야합니다, 어떤 데이터베이스를 대상으로 할 때,하지만 다른 사람들을 목표로 할 때 실패합니다. 나는 그들이 서로를 복사하고 지나치다는 차이점을 절대적으로 알지 못합니다. 그래서 디버깅이 필요한데, 무시할 수 있고, 그냥 무작위 버그로 보았습니다.하지만이 일이 생기면, 나는 놀라지 않을 것입니다. .
[편집] 그 이유는 내가 디버깅하는 경우에 비어있는 것을 반환하는 getMigrationsToExecute ($ direction, $ to)입니다. 어떤 단서가 있다면.
어떤 도움을 주시면 감사하겠습니다, 읽기
감사합니다.
api 및 console에서 '데이터베이스 이름'출력은 동일합니까? Doctrine은 테이블 (migration_versions)을 사용하여 어떤 마이그레이션이 실행되었는지 저장한다. – Mcsky
옙 그 같은 ... 나는 setInteractive를 false로 설정했기 때문에 이는 이론적으로도 프롬프트가 아닙니다. 게다가 API 호출에서 제대로 생성 된 저장소 proc가있어 DB가 올바른지 확인합니다. – Culdz
API에 최신 교리 마이그레이션을 실행하는 코드 부분을 보여줄 수 있습니까? – Mcsky