Example #1
0
 /**
  * @test
  * @functional
  */
 public function testFunctional()
 {
     $db = \Scalr::getDb();
     $entity = new TableEntity();
     $schema = $db->GetOne("SELECT DATABASE()");
     $tableInfo = $entity->findOne([['tableSchema' => $schema]]);
     $this->assertInstanceOf('Scalr\\Model\\Entity\\InformationSchema\\TableEntity', $tableInfo);
     /* @var $tableInfo TableEntity */
     $this->assertNotEmpty($tableInfo->engine);
     $this->assertNotEmpty($tableInfo->tableName);
     $this->assertNotEmpty($tableInfo->createTime);
     $this->assertInstanceOf('DateTime', $tableInfo->createTime);
 }
Example #2
0
 /**
  * {@inheritdoc}
  * @see \Scalr\Upgrade\UpdateInterface::getTableDefinition()
  */
 public function getTableDefinition($table, $schema = null)
 {
     if (!isset($schema)) {
         $schema = $this->db->GetOne("SELECT DATABASE()");
     }
     $entity = new TableEntity();
     $entity->db = $this->db;
     return $entity->findOne([['tableSchema' => $schema], ['tableName' => $table]]);
 }