Ejemplo n.º 1
0
 public function createTable($name)
 {
     try {
         $table = new Table($name, [new Column(DatabaseTable::COLUMN_ID, Type::getType(Type::INTEGER), ['primary' => true, 'autoincrement' => true, 'notnull' => true])]);
         $this->getSchema()->createTable($table);
     } catch (DBALException $e) {
         throw DatabaseException::fromDBALException($e);
     }
 }
Ejemplo n.º 2
0
 public static function createTable(Connection $connection, $tableName)
 {
     $table = new Table($tableName, [new Column(DatabaseTable::COLUMN_ID, Type::getType(Type::INTEGER), ['primary' => true, 'autoincrement' => true, 'notnull' => true])]);
     try {
         $connection->getSchemaManager()->createTable($table);
     } catch (DBALException $e) {
         throw DatabaseException::fromDBALException($e);
     }
 }