Creates a new schema `new_schema_name` as a clone of an existing schema
        `old_schema_name`.
978467
def clone_schema(self, base_schema_name, new_schema_name):
        
        connection.set_schema_to_public()
        cursor = connection.cursor()

        # check if the clone_schema function already exists in the db
        try:
            cursor.execute("SELECT 'clone_schema'::regproc")
        except ProgrammingError:
            self._create_clone_schema_function()
            transaction.commit()

        sql = 'SELECT clone_schema(%(base_schema)s, %(new_schema)s, TRUE)'
        cursor.execute(
            sql,
            {'base_schema': base_schema_name, 'new_schema': new_schema_name}
        )
        cursor.close()
123807
def _createSchemaFiles(self, destPath, schemasPath):
        
        # Create the target directory hierarchy, if neccessary
        ga4ghPath = os.path.join(destPath, 'ga4gh')
        if not os.path.exists(ga4ghPath):
            os.mkdir(ga4ghPath)
        ga4ghSchemasPath = os.path.join(ga4ghPath, 'schemas')
        if not os.path.exists(ga4ghSchemasPath):
            os.mkdir(ga4ghSchemasPath)
        ga4ghSchemasGa4ghPath = os.path.join(ga4ghSchemasPath, 'ga4gh')
        if not os.path.exists(ga4ghSchemasGa4ghPath):
            os.mkdir(ga4ghSchemasGa4ghPath)
        ga4ghSchemasGooglePath = os.path.join(ga4ghSchemasPath, 'google')
        if not os.path.exists(ga4ghSchemasGooglePath):
            os.mkdir(ga4ghSchemasGooglePath)
        ga4ghSchemasGoogleApiPath = os.path.join(
            ga4ghSchemasGooglePath, 'api')
        if not os.path.exists(ga4ghSchemasGoogleApiPath):
            os.mkdir(ga4ghSchemasGoogleApiPath)

        # rewrite the proto files to the destination
        for root, dirs, files in os.walk(schemasPath):
            for protoFilePath in fnmatch.filter(files, '*.proto'):
                src = os.path.join(root, protoFilePath)
                dst = os.path.join(
                    ga4ghSchemasPath,
                    os.path.relpath(root, schemasPath), protoFilePath)
                self._copySchemaFile(src, dst)
637336
private void createSchema() throws SQLException {
		logger.entering(CLASSNAME, "createSchema");
		Connection conn = getConnectionToDefaultSchema();

		logger.log(Level.INFO, schema + " schema does not exists. Trying to create it.");
		PreparedStatement ps = null;
		ps = conn.prepareStatement("CREATE SCHEMA " + schema);
		ps.execute();

		cleanupConnection(conn, null, ps);
		logger.exiting(CLASSNAME, "createSchema");
	}
395488
public static <T> Schema<T> createFrom(MappedSchema<T> ms, 
            Instantiator<T> instantiator, 
            Factory vf, 
            Predicate.Factory pf, 
            String ... args)
    {
        return vf.create(ms.typeClass, ms.fields, ms.fieldsByNumber, 
                ms.fieldsByName, instantiator, pf, args);
    }
1121728
def add_schema(self, schema):
        

        # serialize instances of SchemaNode before parsing
        if isinstance(schema, SchemaNode):
            schema = schema.to_schema()

        for subschema in self._get_subschemas(schema):
            # delegate to SchemaType object
            schema_generator = self._get_generator_for_schema(subschema)
            schema_generator.add_schema(subschema)

        # return self for easy method chaining
        return self
365546
public static <T> Schema<T> createFrom(RuntimeSchema<T> ms,
            Instantiator<T> instantiator,
            Factory vf,
            Predicate.Factory pf,
            String... args)
    {
        return vf.create(ms, instantiator, pf, args);
    }
267671
def create_schema(self, schema):
        
        if schema not in self.schemas:
            sql = "CREATE SCHEMA " + schema
            self.execute(sql)
863725
def _compile_schema(self, schema):
        
        assert self.matcher == schema.matcher

        self.name = schema.name
        self.compiled_type = schema.compiled_type

        return schema.compiled
1362525
protected function createSchema()
    {
        $schema = new MySqlSchema("tblApplicationVersion");
        $schema->addColumn(
            new AutoIncrement("ApplicationVersionID"),
            new Decimal("Version"),
            new Enum("VersionStatus", "NotMigrated", ["NotMigrated", "Migrated", "Failed"]),
            new MediumText("FailureMessages")
        );

        return $schema;
    }
890836
public function clone_with_new_schema(NamedSchema $schema)
    {
        $name = $schema->fullname();
        if (Schema::is_valid_type($name)) {
            throw new SchemaParseException(
                sprintf('Name "%s" is a reserved type name', $name));
        } else if ($this->has_name($name)) {
            throw new SchemaParseException(
                sprintf('Name "%s" is already in use', $name));
        }
        $schemata = new NamedSchemata($this->schemata);
        $schemata->schemata[$name] = $schema;
        return $schemata;
    }
1162843
def copy_table(from_table, name):
    
    metadata = from_table.metadata

    if name in metadata.tables:
        return metadata.tables[name]

    schema = metadata.schema

    columns = [
        copy_column(column, schema)
        for column in from_table.columns
        if should_copy(column)
    ]

    return Table(
        name,
        metadata,
        schema=schema,
        comment=from_table.comment,
        *columns,
        **from_table.kwargs,
    )
125992
def merge_schemas(cls, schema, _schema):
        
        tmp = schema.properties[:]  # copy
        prop = {}
        to_dict = lambda e: prop.update({e.pop('name'): e})
        [to_dict(i) for i in tmp]  # map(to_dict, tmp)
        for _prop in _schema.properties:
            if prop.get(_prop['name']):
                prop.pop(_prop['name'])
        if prop:
            for k, v in prop.items():
                v['name'] = k
                _schema.properties.append(v)
        return _schema
1311076
private static void copyProperties(Schema oldSchema, Schema newSchema) {
    Preconditions.checkNotNull(oldSchema);
    Preconditions.checkNotNull(newSchema);

    Map<String, JsonNode> props = oldSchema.getJsonProps();
    copyProperties(props, newSchema);
  }
861207
def create_schema(self, check_if_exists=False, sync_schema=True,
                      verbosity=1):
        

        # safety check
        connection = connections[get_tenant_database_alias()]
        _check_schema_name(self.schema_name)
        cursor = connection.cursor()

        if check_if_exists and schema_exists(self.schema_name):
            return False

        fake_migrations = get_creation_fakes_migrations()

        if sync_schema:
            if fake_migrations:
                # copy tables and data from provided model schema
                base_schema = get_tenant_base_schema()
                clone_schema = CloneSchema()
                clone_schema.clone_schema(base_schema, self.schema_name)

                call_command('migrate_schemas',
                             tenant=True,
                             fake=True,
                             schema_name=self.schema_name,
                             interactive=False,
                             verbosity=verbosity)
            else:
                # create the schema
                cursor.execute('CREATE SCHEMA %s' % self.schema_name)
                call_command('migrate_schemas',
                             tenant=True,
                             schema_name=self.schema_name,
                             interactive=False,
                             verbosity=verbosity)

        connection.set_schema_to_public()
240582
def extend_schema_spec(self) -> None:
        
        super().extend_schema_spec()

        if self.ATTRIBUTE_FIELDS in self._spec:
            # Add new fields to the schema spec. Since `_identity` is added by the super, new elements are added after
            predefined_field = self._build_time_fields_spec(self._spec[self.ATTRIBUTE_NAME])
            self._spec[self.ATTRIBUTE_FIELDS][1:1] = predefined_field

            # Add new field schema to the schema loader
            for field_schema in predefined_field:
                self.schema_loader.add_schema_spec(field_schema, self.fully_qualified_name)
1198097
function _generate(schemaName) {
  var schema = generateSchema(schemaName, this._instructions, this._macros, this._opts.strict);
  this.ajv.removeSchema(schema.id);
  return schema;
}
1364659
public static Schema subSetOf(String newName, Schema schema, String... subSetFields) {
		List<Field> newSchema = new ArrayList<Field>();
		for(String subSetField: subSetFields) {
			newSchema.add(schema.getField(subSetField));
		}
		return new Schema(newName, newSchema);
	}