System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateCreateSchema C# (CSharp) Method

GenerateCreateSchema() protected method

Generates SQL to create a database schema. Generated SQL should be added using the Statement method.
protected GenerateCreateSchema ( string schema ) : void
schema string The name of the schema to create.
return void
        protected virtual void GenerateCreateSchema(string schema)
        {
            Check.NotEmpty(schema, "schema");

            using (var writer = Writer())
            {
                writer.Write("IF schema_id('");
                writer.Write(Escape(schema));
                writer.WriteLine("') IS NULL");
                writer.Indent++;
                writer.Write("EXECUTE('CREATE SCHEMA ");
                writer.Write(Escape(Quote(schema)));
                writer.Write("')");

                Statement(writer);
            }
        }