jamband\schemadump\SchemaDumpController::actionCreate PHP Method

actionCreate() public method

Generates the 'createTable' code.
public actionCreate ( string $schema = '' ) : integer
$schema string the schema of the tables. Defaults to empty string, meaning the current or default schema name.
return integer the status of the action execution
    public function actionCreate($schema = '')
    {
        $offset = 0;
        $stdout = '';
        foreach ($this->db->schema->getTableSchemas($schema) as $table) {
            if ($table->name === $this->migrationTable) {
                continue;
            }
            $stdout .= "// {$table->name}\n";
            $stdout .= "\$this->createTable('{{%{$table->name}}}', [\n";
            $stdout .= $this->getColumnsDefinition($table->columns);
            $stdout .= $this->getPrimaryKeyDefinition($table->primaryKey, $stdout, $offset);
            $stdout .= "], \$this->tableOptions);\n\n";
            $offset = mb_strlen($stdout, Yii::$app->charset);
        }
        foreach ($this->db->schema->getTableSchemas($schema) as $table) {
            $stdout .= $this->getForeignKeyDefinition($table);
        }
        $this->stdout(strtr($stdout, [' . ""' => '', '" . "' => '']));
    }