Creates the tables defined in configuration file, or overridden.

@throws \Exception
345867
protected function createTables()
    {
        if (empty( self::$tables )) {
            throw new \Exception('Cannot create tables, as no configuration file given, or the ::$tables is not overridden.');
        }
        $client = $this->dynamoDb->getClient();

        foreach (self::$tables as $tableData) {
            $tableName = $tableData['TableName'];

            if ( ! $this->tableExists($tableName)) {
                $this->comment(sprintf('Creating table %s', $tableName));

                $client->createTable($tableData);

                $client->waitUntil('TableExists', array(
                    'TableName' => $tableName,
                ));

                $this->info(sprintf('Table "%s" created.', $tableName));
            } else {
                $this->warn(sprintf('Table "%s" already exists.', $tableName));
            }
        }
    }
143308
protected function createTables()
    {
        $this->createTable(static::tableName(), [
            'objectId' => $this->string()->notNull(),
            'elementId' => $this->integer()->notNull(),
            'fieldId' => $this->integer()->notNull(),
            'siteId' => $this->integer()->notNull(),
            'sortOrder' => $this->smallInteger()->unsigned(),
            'dateCreated' => $this->dateTime()->notNull(),
            'dateUpdated' => $this->dateTime()->notNull(),
            'uid' => $this->uid(),
        ]);
    }
261195
private void createTables() throws SQLException, BlockStoreException {
        Statement s = conn.get().createStatement();
        // create all the database tables
        for (String sql : getCreateTablesSQL()) {
            if (log.isDebugEnabled()) {
                log.debug("DatabaseFullPrunedBlockStore : CREATE table [SQL= {0}]", sql);
            }
            s.executeUpdate(sql);
        }
        // create all the database indexes
        for (String sql : getCreateIndexesSQL()) {
            if (log.isDebugEnabled()) {
                log.debug("DatabaseFullPrunedBlockStore : CREATE index [SQL= {0}]", sql);
            }
            s.executeUpdate(sql);
        }
        s.close();

        // insert the initial settings for this store
        PreparedStatement ps = conn.get().prepareStatement(getInsertSettingsSQL());
        ps.setString(1, CHAIN_HEAD_SETTING);
        ps.setNull(2, Types.BINARY);
        ps.execute();
        ps.setString(1, VERIFIED_CHAIN_HEAD_SETTING);
        ps.setNull(2, Types.BINARY);
        ps.execute();
        ps.setString(1, VERSION_SETTING);
        ps.setBytes(2, "03".getBytes());
        ps.execute();
        ps.close();
        createNewStore(params);
    }
158493
public function create()
    {
        try {
            $schema = explode(';', str_replace(PHP_EOL, '', $this->getSchema()));
            array_pop($schema);

            # db structure
            $sql = array_shift($schema);
            $this->db->query($sql . ';');

            # indecies
            foreach($schema as $sql) {
                $this->db->query($sql . ';');
            }
        } catch(Exception $e) {
            throw new Exception($e->getMessage(), 1);
        }
    }
1133965
protected function createTables()
    {
        $this->createTable(TokensRecord::tableName(), [
            'id' => $this->primaryKey(),
            'accessToken' => $this->text()->notNull(),
            'refreshToken' => $this->text(),
            'providerId' => $this->integer()->notNull(),
            'values' => $this->text(),
            'enabled' => $this->boolean(),
            'dateExpires' => $this->dateTime(),
            'dateUpdated' => $this->dateTime()->notNull(),
            'dateCreated' => $this->dateTime()->notNull(),
            'uid' => $this->uid()
        ]);

        $this->createTable(ProviderRecord::tableName(), [
            'id' => $this->primaryKey(),
            'handle' => $this->string()->notNull(),
            'clientId' => $this->string(ProviderRecord::CLIENT_ID_LENGTH)->notNull(),
            'clientSecret' => $this->string(ProviderRecord::CLIENT_SECRET_LENGTH),
            'scopes' => $this->string(),
            'class' => $this->string()->notNull(),
            'settings' => $this->text(),
            'enabled' => $this->boolean(),
            'dateUpdated' => $this->dateTime()->notNull(),
            'dateCreated' => $this->dateTime()->notNull(),
            'uid' => $this->uid()
        ]);
    }
282458
protected function initTable(): void
    {
        $tableClass = class_namespace(static::class) . '\\Table';

        // check class initialization
        if (!class_exists($tableClass) || !is_subclass_of($tableClass, TableInterface::class)) {
            throw new TableNotFoundException('`Table` class is not exists or not initialized');
        }

        /**
         * @var TableInterface $tableClass
         */
        $this->setTable($tableClass::getInstance());
    }
317993
protected function deleteTables()
    {
        if (empty( self::$tables )) {
            throw new \Exception('Cannot delete tables, as no configuration file given, or the ::$tables is not overridden.');
        }
        $client = $this->dynamoDb->getClient();

        $defaultAnswer = $this->input->getOption('yes');
        $a = 'n';
        foreach (self::$tables as $tableData) {
            $tableName = $tableData['TableName'];

            if ($this->tableExists($tableName)) {

                if ($defaultAnswer === false) {
                    $a = $this->ask(sprintf('Are you sure you want to delete table "%s"? [y/N]', $tableName), 'n');
                }

                if ($defaultAnswer || strtolower($a) === 'y') {
                    // Reset the answer.
                    $a = null;
                    $this->comment(sprintf('Deleting table "%s"', $tableName));

                    $client->deleteTable([
                        'TableName' => $tableName,
                    ]);
                    $client->waitUntil('TableNotExists', ['TableName' => $tableName]);

                    $this->info('Table deleted.');
                } else {
                    $this->comment(sprintf('Skipping table %s', $tableName));
                }
            } else {
                $this->warn(sprintf('Table "%s" does not exist.', $tableName));
            }
        }
    }
1178524
public static function init()
    {
        if(static::$isInited)
        {
            throw new \RuntimeException('MemoryTableManager can not repeated init');
        }
        foreach(static::$tables as $name => $option)
        {
            $table = new \Swoole\Table($option['size'] ?? 1024, $option['conflictProportion'] ?? 0.2);
            foreach($option['columns'] as $column)
            {
                $table->column($column['name'], $column['type'] ?? swoole_table::TYPE_STRING, $column['size'] ?? 0);
            }
            if(!$table->create())
            {
                throw new \RuntimeException('MemoryTableManager create table failed');
            }
            static::$tables[$name] = $table;
        }
        static::$isInited = true;
    }
951252
private void createTables() {
        this.db.execSQL(DbConstants.DROP_METADATA_STATEMENT);
        this.db.execSQL(DbConstants.DROP_INDEX_STATEMENT);
        this.db.execSQL(DbConstants.DROP_CATEGORY_MAP_STATEMENT);
        this.db.execSQL(DbConstants.DROP_DATA_STATEMENT);
        this.db.execSQL(DbConstants.DROP_CATEGORIES_STATEMENT);

        this.db.execSQL(DbConstants.CREATE_CATEGORIES_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_DATA_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_CATEGORY_MAP_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_INDEX_STATEMENT);
        this.db.execSQL(DbConstants.CREATE_METADATA_STATEMENT);
    }
137059
public function tables()
    {
        $db = ConnectionManager::get('default');
        $db->connect();
        $schemaCollection = $db->schemaCollection();
        $tables = $schemaCollection->listTables();
        foreach ($tables as $table) {
            $this->out(sprintf('- %s', $table));
        }
    }
568597
protected function createTableIfNeeded()
    {
        if ($this->tableExists) {
            return false;
        }

        if ($this->tableExist($this->tableName)) {
            $this->tableExists = true;
            return false;
        }

        $this->createTable();

        $this->tableExists = true;
        return true;
    }
1296622
public function create() {
        $migration = $this->getMessages();
        if (!$migration) {
            $this->db()->insert($this->table, array('migration' => get_class($this), 'state' => false));
        } else {
            throw new \Exception('Migration ' .  get_class($this) . ' already created');
        }
    }
12995
protected void createTable(){
        sqlManager.executeUpdate(
                new StringSqlResource(String.format("CREATE TABLE %s (VERSION NUMERIC NOT NULL)", tableName)));

        sqlManager.executeUpdate(
                new StringSqlResource(String.format("INSERT INTO %s (0))", tableName)));
    }
554016
protected function createModels()
    {
        $path           = $this->option('path');
        $namespace      = $this->option('namespace');
        $connectionName = $this->option('connection');

        $tableNames = $this->getDatabaseTableNames($connectionName);

        /** @var \ViKon\DbExporter\Meta\Model[] $models */
        $models = [];
        foreach ($tableNames as $tableName) {
            if ($this->skipTable($tableName)) {
                continue;
            }

            $models[$tableName] = new Model($connectionName, $tableName);
            $models[$tableName]->setPath($path);
            $models[$tableName]->setNamespace($namespace);
            $models[$tableName]->map();
        }

        return $models;
    }
1334955
protected function initRoomsTable(): void
    {
        $this->rooms = new Table($this->config['room_rows']);
        $this->rooms->column('value', Table::TYPE_STRING, $this->config['room_size']);
        $this->rooms->create();
    }
814386
public function seedDatabase(): void
    {
        (new SeedSiteSettingTable())->run();
        (new SeedUserTable())->run();
        (new SeedGedcomTable())->run();
        (new SeedGedcomSettingTable())->run();
        (new SeedDefaultResnTable())->run();
    }
728486
protected function prepareIgnoreTables()
    {
        if (isset($this->params['ignore_tables'])) {
            foreach ($this->params['ignore_tables'] as $ignoreTable) {
                if ($this->params['all_databases']) {
                    if (false === strpos($ignoreTable, '.')) {
                        throw new \LogicException(
                            'When dumping all databases both database and table must be specified when ignoring table'
                        );
                    }
                    $this->ignoreTables .= sprintf('--ignore-table=%s ', $ignoreTable);
                } else {
                    $this->ignoreTables .= sprintf('--ignore-table=%s.%s ', $this->params['database'], $ignoreTable);
                }
            }
        }
    }