Creates a new table.

@return void
979360
public function createTable(Table $table)
    {
        $createFlags = AbstractPlatform::CREATE_INDEXES|AbstractPlatform::CREATE_FOREIGNKEYS;
        $this->_execSql($this->_platform->getCreateTableSQL($table, $createFlags));
    }
143039
def _create_table(self):
        '''
        
        '''
        self._cursor.execute('''
            CREATE TABLE IF NOT EXISTS %(name)s ( %(fields)s )
        ''' % {
            'name': self._name,
            'fields': ','.join('%s %s' % (k, v) for (k, v) in self._fields)
        })
        self._connection.commit()
1023119
public function createTables() {
        $answer = strtoupper($this->in('Existing tables will be deleted, continue?', array('Y', 'N')));

        if ($answer === 'N') {
            return false;
        }

        $schemas = glob(CakePlugin::path($this->plugin) . '/Config/Schema/*.sql');
        $executed = 0;
        $tables = array();

        // Loop over schemas and execute queries
        $this->out('<success>Creating tables...</success>');

        foreach ($schemas as $schema) {
            $table = $this->tablePrefix . str_replace('.sql', '', basename($schema));
            $tables[] = $table;

            $executed += $this->executeSchema($schema);
            $this->out($table);
        }

        // Rollback if a failure occurs
        if ($executed != count($schemas)) {
            $this->out('<error>Failed to create database tables; rolling back</error>');

            foreach ($tables as $table) {
                $this->db->execute(sprintf('DROP TABLE `%s`;', $table));
            }

            return false;
        }

        $this->out('<success>Tables created successfully, proceeding...</success>');
        return true;
    }
1219601
public function create()
    {
        $sm = $this->em->getConnection()->getSchemaManager();
        $table = $this->em->getClassMetadata(self::$entityName)->getTableName();

        return $sm->tablesExist(array($table));
    }
1202125
private function create_table()
    {
        if ($this->type == 'sqlite') {
            $auto_increase = '';
        } else {
            $auto_increase = ' AUTO_INCREMENT';
        }
        $query = "CREATE TABLE cache (cache_id INTEGER PRIMARY KEY" . $auto_increase . ", unique_vars TEXT, expires INT, body TEXT)";
        if ($this->db->query($query)) {
            // Ok
        } else {
            // TODO: Handle error
            echo $this->db->error;
        }
    }
716680
protected function createTableIfDoesNotExist() : void
    {
        /**
         * Note: This is a somewhat hacky way to determine which database driver we're using
         * Ideally, in the future, the query builder will be able to create tables for us
         * Until then, we'll infer the database driver from the query builder type
         */
        switch (get_class($this->queryBuilder)) {
            case MySqlQueryBuilder::class:
                $sql = 'CREATE TABLE IF NOT EXISTS ' .
                    $this->tableName .
                    ' (migration varchar(255), dateran timestamp NOT NULL, PRIMARY KEY (migration));';
                break;
            case PostgreSqlQueryBuilder::class:
                $sql = 'CREATE TABLE IF NOT EXISTS ' .
                    $this->tableName .
                    ' (migration text primary key, dateran timestamp with time zone NOT NULL);';
                break;
            default:
                throw new RuntimeException('Unexpected query builder type ' . get_class($this->queryBuilder));
        }

        $statement = $this->connection->prepare($sql);
        $statement->execute();
    }
39799
public function createSchema()
    {
        $query = 'CREATE TABLE IF NOT EXISTS `'.self::LIST_COLLECTION_TABLE_NAME.'` (
          `id` int NOT NULL AUTO_INCREMENT,
          `uuid` varchar(255) UNIQUE NOT NULL,
          `headers` text DEFAULT NULL,
          `created_at` TIMESTAMP NOT NULL,
          `updated_at` TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW(),
          PRIMARY KEY (`id`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;';

        $this->pdo->exec($query);

        $query2 = 'CREATE TABLE IF NOT EXISTS `'.self::LIST_ELEMENT_TABLE_NAME.'` (
          `id` int NOT NULL AUTO_INCREMENT,
          `uuid` varchar(255) NOT NULL,
          `list` varchar(255) NOT NULL,
          `body` text DEFAULT NULL,
          `created_at` TIMESTAMP NOT NULL,
          `updated_at` TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW(),
          PRIMARY KEY (`id`),
          CONSTRAINT `list_foreign_key` FOREIGN KEY (`list`) REFERENCES `'.self::LIST_COLLECTION_TABLE_NAME.'`(`uuid`) ON UPDATE CASCADE ON DELETE CASCADE
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;';

        $this->pdo->exec($query2);
    }
1069520
protected function prepareTable()
    {
        if (!$this->schema->hasTable($this->table)) {
            $this->schema->table($this->table)
                ->string('id', 128)
                ->timestamp('created_at')
                ->exec();
        }
    }
433266
public function createTable(Table $table)
    {
        if (!$table->hasOption('charset') && !$table->hasOption('collate')) {
            $connParams = $this->_conn->getParams();
            if (isset($connParams['defaultTableOptions']['charset']) && isset($connParams['defaultTableOptions']['collate'])) {
                $table
                    ->addOption('charset', $connParams['defaultTableOptions']['charset'])
                    ->addOption('collate', $connParams['defaultTableOptions']['collate'])
                ;
            }
        }

        return parent::createTable($table);
    }
570401
protected function createTable()
	{
		try
		{
			$command=$this->db->createCommand();
			$command->createTable($this->stateTableName,array(
				$this->keyField=>'string NOT NULL',
				$this->valueField=>'text NOT NULL',
				'PRIMARY KEY ('.$this->db->quoteColumnName($this->keyField).')'
			));
		}
		catch (CDbException $e)
		{
			throw new CException(Yii::t('yii','Can\'t create state persister table. Check CREATE privilege for \'{db}\' connection user or create table manually with SQL: {sql}.',array('{db}'=>$this->dbComponent,'{sql}'=>$command->text ) ) );
		}
	}
1211973
public function create()
    {
        $this->isTracking = true;

        $this->setAttributes(array(
            'status'  => self::STATUS_WAITING,
            'created' => time(),
            'updated' => time()
        ));
    }
636203
public function createInstallationProgressTable()
    {
        Schema::create('tbl_antares_installation', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->unique();
            $table->text('content')->nullable();
        });
    }
156389
public function setup_table() {
        /*
         * Table has 3 columns
         *| course  | final grade | rank (optional) |
         */

        // setting up table headers
        if ($this->showrank['any']) {
            $tablecolumns = array('coursename', 'grade', 'rank');
            $tableheaders = array($this->get_lang_string('coursename', 'grades'),
                                  $this->get_lang_string('grade'),
                                  $this->get_lang_string('rank', 'grades'));
        } else {
            $tablecolumns = array('coursename', 'grade');
            $tableheaders = array($this->get_lang_string('coursename', 'grades'),
                                  $this->get_lang_string('grade'));
        }
        $this->table = new flexible_table('grade-report-overview-'.$this->user->id);

        $this->table->define_columns($tablecolumns);
        $this->table->define_headers($tableheaders);
        $this->table->define_baseurl($this->baseurl);

        $this->table->set_attribute('cellspacing', '0');
        $this->table->set_attribute('id', 'overview-grade');
        $this->table->set_attribute('class', 'boxaligncenter generaltable');

        $this->table->setup();
    }
740568
protected function createTable()
    {
        if ($this->db->schema->getTableSchema($this->sessionTable) === null) {
            $cmd = $this->db->createCommand();
            $cmd->createTable($this->sessionTable, [
                'id' => 'CHAR(40) PRIMARY KEY',
                'expire' => 'integer',
                'data' => 'binary',
            ])->execute();
        }
    }
1237259
public function createTable()
    {
        $bean = R::xdispense($this->tableName);
        R::store($bean);
        R::trash($bean);
    }
1101176
function create()
    {
        //Tablela ARTICLE
        $this->db->query("CREATE TABLE `article` (
                          `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                          `category` int(11) NOT NULL DEFAULT '1',
                          `status` int(11) NOT NULL,
                          `author` int(11) NOT NULL DEFAULT '1',
                          `rateup` int(11) NOT NULL DEFAULT '0',
                          `ratedown` int(11) NOT NULL DEFAULT '0',
                          `access` int(11) NOT NULL DEFAULT '0',
                          `pubdate` datetime DEFAULT NULL,
                          `editdate` datetime DEFAULT NULL,
                          `link` varchar(300) DEFAULT NULL,
                          `tags` varchar(300) DEFAULT NULL,
                          `title` varchar(300) DEFAULT NULL,
                          `media` text,
                          `resume` text,
                          PRIMARY KEY (`id`)
                        ) ENGINE=InnoDB DEFAULT CHARSET=utf8");

        //Tablela ARTICLECONTENT
            $this->db->query("CREATE TABLE `articlecontent` (
                          `article` int(10) unsigned NOT NULL,
                          `editdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
                          `content` longtext NOT NULL,
                          KEY `article` (`article`),
                          CONSTRAINT `articlecontent_ibfk_1` FOREIGN KEY (`article`) REFERENCES `article` (`id`)
                        ) ENGINE=InnoDB DEFAULT CHARSET=utf8");

        //Tablela CATEGORY
            $this->db->query("CREATE TABLE `category` (
                          `id` int(11) NOT NULL AUTO_INCREMENT,
                          `name` varchar(200) NOT NULL,
                          `description` varchar(500) NOT NULL,
                          PRIMARY KEY (`id`)
                        ) ENGINE=InnoDB DEFAULT CHARSET=latin1");

        //Tablela STATUS
            $this->db->query("CREATE TABLE `status` (
                          `id` int(11) NOT NULL AUTO_INCREMENT,
                          `name` varchar(200) NOT NULL,
                          `description` varchar(500) NOT NULL,
                          PRIMARY KEY (`id`)
                        ) ENGINE=InnoDB DEFAULT CHARSET=latin1");

        //Tablela STATUS - INSERT
            $this->db->query("INSERT INTO `status` (`id`, `name`, `description`) VALUES
                        (1, 'Publicar imediatamente', 'Artigo publicado imediatamente depois de criado/editado.'),
                        (2, 'Salvar como Rascunho', 'Mantém como um rascunho para futura edição (estacionado)'),
                        (3, 'Deletar ou Desabilitar', 'Sinaliza que o artigo está deletado, porém, se mantém salvo para futura auditoria. '),
                        (4, 'Acesso Restrito - logado', 'Permite acesso somente a leitores logados.'),
                        (5, 'Editando...',  'O registro fica reservado para edição por 24 horas.'),
                        (6, 'Livre para reúso', 'Registro usado anteriormente, porém, livre para reúso.')");

        //Tablela USUARIO
            $this->db->query("CREATE TABLE `usuario` (
                          `id` int(11) NOT NULL AUTO_INCREMENT,
                          `login` varchar(255) DEFAULT NULL,
                          `senha` varchar(300) DEFAULT NULL,
                          `nome` varchar(255) DEFAULT NULL,
                          `token` varchar(200) DEFAULT NULL,
                          `vida` int(11) unsigned DEFAULT NULL,
                          `nivel` varchar(45) DEFAULT NULL COMMENT '[A]dmin, [E]ditor, [G]uest',
                          `status` char(1) DEFAULT NULL COMMENT '[A]ctive, [D]isable',
                          PRIMARY KEY (`id`)
                        ) ENGINE=InnoDB DEFAULT CHARSET=utf8");

        //Tablela USUARIO - INSERT
            $this->db->query("INSERT INTO `usuario` (`id`, `login`, `senha`, `nome`, `token`, `vida`, `nivel`, `status`) VALUES
                        (1, 'admin',  'admin#123',  'Administrator',  'DrFol:LeinC%[4CBVcT$hW<mdLEXE)vdCiZVV%Vq', 908,  'A',  'A'),
                        (2, 'editor', 'editor#123', 'Editor', 'v!BPf#hePX30Ks>GK~çjj',  908,  'E',  'A'),
                        (3, 'jessica',  'jessica#123',  'Jessica Mendes', '=+$Wr%yLEbxe7P11iWm1=d)Y@O%47Vow(2r{mv*u', 908,  'A',  'A'),
                        (5, 'guest',  'guest#123',  'Guest',  'IK:QernGB9azWQuh-A6BD',  0,  'G',  'A'),
                        (6, 'test', 'test#123', 'Disabled User',  '![vw*$3lP_z!#IVfe.#n8NiTKBE8<F*=40/B5@tq', 908,  'A',  'D'),
                        (7, 'evora',  'evora123', 'Evora Simpson Smith',  'sadkljhsad9sa04)(sadjhd',  908,  'A',  'A')");

        //Tablela USUARIOPAR - PARAMETROS DE USUÁRIOS
            $this->db->query("CREATE TABLE `usuariopar` (
                        `id` int(11) NOT NULL AUTO_INCREMENT,
                        `usuario` int(11) NOT NULL,
                        `parametro` varchar(100) NOT NULL,
                        `valor` varchar(1000) NOT NULL,
                        PRIMARY KEY (`id`)
                      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Lista de parâmetros extras para cada usuário (opcional e varia entre usuários)'");

        //Tabela ACCESS
            $this->db->query("CREATE TABLE `access` (
                        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
                        `data` datetime NOT NULL,
                        `ip` varchar(100) NOT NULL,
                        `uri` varchar(300) NOT NULL,
                        `method` varchar(20) NOT NULL,
                        `agent` varchar(500) NOT NULL,
                        PRIMARY KEY (`id`)
                      ) ENGINE=MyISAM DEFAULT CHARSET=utf8");
    }
355545
protected function getTable(): Table
    {
        if ($this->table === null) {
            $this->table = new Table($this->output);
        }
        return $this->table;
    }