Generate classes.

@param array $schema
345443
protected function generateClasses(array $schema)
    {
        $this->generateDataTypes($schema);
        $this->generateProperties($schema);
        $this->generateTypes($schema);
    }
1355091
protected function fetchTables($schema)
    {
        $rows = $this->arraify($this->connection->select('SHOW FULL TABLES FROM '.$this->wrap($schema).' WHERE Table_type="BASE TABLE"'));
        $names = array_column($rows, 'Tables_in_'.$schema);

        return Arr::flatten($names);
    }
522233
public function execute(Schema $schema)
    {
        $tables = $this->getSchemaTables();
        $instance = $this->getInstance();
        foreach ($tables as $table) {
            $columns = $this->getTableColumns($table['name']);
            $this->parseProperty($table['name'], $table['comment'], $columns, $schema, $instance);
        }
    }
277500
public function setSchema($schema)
    {
        $this->schema = $schema;
        $sessionVars  = [
            'CURRENT_SCHEMA' => $schema,
        ];

        return $this->setSessionVars($sessionVars);
    }
1043542
public function updateDataSchema(&$schema)
    {
        // The keys from the SecurityAlert model that we need in the React component
        $keysToPass = ['Identifier', 'ExternalLink'];

        $alerts = [];
        foreach ($this->owner->SecurityAlerts()->toNestedArray() as $alert) {
            $alerts[] = array_intersect_key($alert, array_flip($keysToPass));
        }

        $schema['securityAlerts'] = $alerts;
    }
1363186
public function setSchema($schema)
    {
        if (!\is_string($schema) && !$schema instanceof SchemaDefinitionInterface) {
            throw new InvalidSchemaDefinitionException();
        }

        $this->schema = $schema;
    }
323708
public function createSchema($source, $schema) {
		if (!$schema instanceof $this->_classes['schema']) {
			throw new InvalidArgumentException("Passed schema is not a valid `{$class}` instance.");
		}

		$columns = [];
		$primary = null;

		$source = $this->name($source);

		foreach ($schema->fields() as $name => $field) {
			$field['name'] = $name;
			if ($field['type'] === 'id') {
				$primary = $name;
			}
			$columns[] = $this->column($field);
		}
		$columns = join(",\n", array_filter($columns));

		$metas = $schema->meta() + ['table' => [], 'constraints' => []];

		$constraints = $this->_buildConstraints($metas['constraints'], $schema, ",\n", $primary);
		$table = $this->_buildMetas('table', $metas['table']);

		$params = compact('source', 'columns', 'constraints', 'table');
		return $this->_execute($this->renderCommand('schema', $params));
	}
535033
public function upgradeSchema(Schema $schema)
    {
        try {
            $table = $schema->getTable('SystemDatabaseQueryLog');
            $table->addColumn('ID', 'integer', ['unsigned' => true, 'autoincrement' => true]);
            $table->setPrimaryKey(['ID']);
        } catch (\Exception $e) {
        }
    }
794875
protected function addRelationToSchema(array $schema, string $module): array
    {
        if (isset($schema['definitions']['relation'])) {
            $relations = Utility::getRealRelationFields($module);
            if (!empty($relations)) {
                $schema['definitions']['relation']['enum'] = $relations;
            }
        }

        return $schema;
    }
386261
protected function verifySchema(array $schema)
    {
        $customTypes = isset($schema['customTypes']) ? $schema['customTypes'] : [];
        if (!is_array($customTypes)) {
            throw new Exception("Given value for key 'customTypes' is not an array.");
        }

        $properties = isset($schema['properties']) ? $schema['properties'] : null;
        if (!is_array($properties)) {
            throw new Exception("Missing valid value for 'properties' key within given schema.");
        }

        return [ $customTypes, $properties ];
    }
928824
public function parse($schema)
    {
        $fields = $this->splitIntoFields($schema);

        foreach ($fields as $field) {
            $segments = $this->parseSegments($field);

            $this->addField($segments);
        }

        return $this->schema;
    }
1374244
public function build($class)
    {
        if(!isset($this->_properties))
            throw new Exception("A schema must have properties");

        return new Schema($class, array(
            'properties' => $this->_properties,
            'relationships' => $this->_relationships,
            'getters' => $this->_getters,
            'setters' => $this->_setters,
            'events' => $this->_events
        ));
    }
1117949
private function addSchema(Schema $schema)
    {
        if (array_key_exists($schema->getName(), $this->schemas)) {
            throw new \Exception(sprintf('Schema "%s" is allready registered.', $schema->getName()));
        }

        $this->schemas[$schema->getName()] = $schema;

        return $this;
    }
1347439
public function generate_schema() {
		$schema = "CREATE TABLE `".$this->name."` (\n";
		
		for($i = 0; $i < count($this->details); $i++) {
			
			if(!isset($this->details[$i]['options'])) {
				$this->details[$i]['options'] = array();
			}
			
			$schema .= "`".$this->details[$i]['name']."` ";
			$schema .= $this->type($this->details[$i]);
			$schema .= $this->options($this->details[$i]['options']);
			$schema .= ",\n";
		}
		
		$schema .= $this->table_keys();
		$schema .= ')';
		$schema .= $this->engine();
		
		return $schema;
	}
104735
protected function writeSchemaHelp($schema) {
        // Write the command description.
        $meta = Cli::val(Cli::META, $schema, []);
        $description = Cli::val('description', $meta);

        if ($description) {
            echo implode("\n", Cli::breakLines($description, 80, false)).PHP_EOL.PHP_EOL;
        }

        unset($schema[Cli::META]);

        // Add the help.
        $schema['help'] = [
            'description' => 'Display this help.',
            'type' => 'boolean',
            'short' => '?'
        ];

        echo Cli::bold('OPTIONS').PHP_EOL;

        ksort($schema);

        $table = new Table();
        $table->setFormatOutput($this->formatOutput);

        foreach ($schema as $key => $definition) {
            $table->row();

            // Write the keys.
            $keys = "--{$key}";
            if ($shortKey = Cli::val('short', $definition, false)) {
                $keys .= ", -$shortKey";
            }
            if (Cli::val('required', $definition)) {
                $table->bold($keys);
            } else {
                $table->cell($keys);
            }

            // Write the description.
            $table->cell(Cli::val('description', $definition, ''));
        }

        $table->write();
        echo PHP_EOL;

        $args = Cli::val(Cli::ARGS, $meta, []);
        if (!empty($args)) {
            echo Cli::bold('ARGUMENTS').PHP_EOL;

            $table = new Table();
            $table->setFormatOutput($this->formatOutput);

            foreach ($args as $argName => $arg) {
                $table->row();

                if (Cli::val('required', $arg)) {
                    $table->bold($argName);
                } else {
                    $table->cell($argName);
                }

                $table->cell(Cli::val('description', $arg, ''));
            }
            $table->write();
            echo PHP_EOL;
        }
    }
362941
def generate(schema_file, all_options):
    ''''''
    schema = load_schema_file(open(schema_file, 'r'))
    config_parser = generate_config_parser(schema, include_all=all_options)
    config_parser.write(sys.stdout)
1263500
public function generate($table, $schema, $database)
    {
        $this->database = $database;
        $columns = $schema->listTableColumns($table);
        if (empty($columns)) {
            return false;
        }

        $indexParser = new IndexParser($table, $schema);
        $fields = $this->setEnum($this->getFields($columns, $indexParser), $table);
        $indexes = $this->getMultiFieldIndexes($indexParser);
        return array_merge($fields, $indexes);
    }