예제 #1
0
 /**
  * @dataProvider providesSchemaFiles
  * @param string $xml
  */
 public function testZeroChangeOnSchemaMigrations($xml)
 {
     $xml = str_replace('*dbprefix*', $this->testPrefix, $xml);
     $schemaFile = 'static://test_db_scheme';
     file_put_contents($schemaFile, $xml);
     // apply schema
     $this->manager->createDbFromStructure($schemaFile);
     $schemaReader = new MDB2SchemaReader($this->config, $this->connection->getDatabasePlatform());
     $endSchema = $schemaReader->loadSchemaFromFile($schemaFile);
     // get the diff
     /** @var SchemaDiff $diff */
     $migrator = $this->manager->getMigrator();
     $diff = $this->invokePrivate($migrator, 'getDiff', [$endSchema, $this->connection]);
     // no sql statement is expected
     $sqls = $diff->toSql($this->connection->getDatabasePlatform());
     $this->assertEquals([], $sqls);
 }
예제 #2
0
파일: migrator.php 프로젝트: kenwi/core
 public function testReservedKeywords()
 {
     $startSchema = new Schema(array(), array(), $this->getSchemaConfig());
     $table = $startSchema->createTable($this->tableName);
     $table->addColumn('id', 'integer', array('autoincrement' => true));
     $table->addColumn('user', 'string', array('length' => 255));
     $table->setPrimaryKey(array('id'));
     $endSchema = new Schema(array(), array(), $this->getSchemaConfig());
     $table = $endSchema->createTable($this->tableName);
     $table->addColumn('id', 'integer', array('autoincrement' => true));
     $table->addColumn('user', 'string', array('length' => 64));
     $table->setPrimaryKey(array('id'));
     $migrator = $this->manager->getMigrator();
     $migrator->migrate($startSchema);
     $migrator->checkMigrate($endSchema);
     $migrator->migrate($endSchema);
     $this->assertTrue(true);
 }
예제 #3
0
 private function makeTestTable()
 {
     $schemaManager = new MDB2SchemaManager($this->connection);
     $schemaManager->createDbFromStructure(__DIR__ . '/testschema.xml');
 }