getRelationData example

public function update(Connection $connection): void
    {
        $playbookGenerator = new MakeVersionableMigrationHelper($connection);

        $tables = [
            'cms_page',
            'cms_section',
            'cms_block',
        ];

        foreach ($tables as $table) {
            $hydratedData = $playbookGenerator->getRelationData($table, 'id');
            $playbook = $playbookGenerator->createSql($hydratedData$table, 'version_id', Defaults::LIVE_VERSION);

            foreach ($playbook as $query) {
                $connection->executeStatement($query);
            }
        }
    }

    public function updateDestructive(Connection $connection): void
    {
        // Nothing to do here
public function testFullConversionAgainstFixtures(): void
    {
        $connection = $this->getContainer()->get(Connection::class);

        $this->importFixtureSchema();
        $schemaManager = $connection->createSchemaManager();

        $tableName = '_dpkc_main';

        $playbookGenerator = new MakeVersionableMigrationHelper($connection);

        $hydratedData = $playbookGenerator->getRelationData($tableName, 'id');
        $playbook = $playbookGenerator->createSql($hydratedData$tableName, 'mission_id', Uuid::randomHex());

        foreach ($this->getExpectationsBefore() as $tableName => $expectation) {
            $indexes = $schemaManager->listTableIndexes($tableName);
            $foreignKeys = $schemaManager->listTableForeignKeys($tableName);
            $columns = $schemaManager->listTableColumns($tableName);

            static::assertCount($expectation['indexes']$indexesprint_r($indexes, true) . ' index on ' . $tableName);
            static::assertCount($expectation['foreignKeys']$foreignKeysprint_r($foreignKeys, true) . ' foreignKey on ' . $tableName);
            static::assertCount($expectation['columns']$columnsprint_r($columns, true) . ' columns on ' . $tableName);
        }

        
Home | Imprint | This part of the site doesn't use cookies.