Example #1
0
        public void ApplyAllConfiguredChangesToDatabase()
        {
            var patch = new SchemaPatch(this);

            var allSchemaNames = AllSchemaNames();

            DatabaseSchemaGenerator.WriteSql(StoreOptions, allSchemaNames, patch.UpWriter);

            patch.Updates.Apply(this, patch.UpdateDDL);

            foreach (var schemaObject in AllSchemaObjects())
            {
                schemaObject.GenerateSchemaObjectsIfNecessary(StoreOptions.AutoCreateSchemaObjects, this, patch);
            }
        }
Example #2
0
        public string ToDDL()
        {
            var writer = new StringWriter();

            var allSchemaNames = AllSchemaNames();

            DatabaseSchemaGenerator.WriteSql(StoreOptions, allSchemaNames, writer);

            foreach (var schemaObject in AllSchemaObjects())
            {
                schemaObject.WriteSchemaObjects(this, writer);
            }

            return(writer.ToString());
        }
Example #3
0
        public void ApplyAllConfiguredChangesToDatabase()
        {
            var patch = new SchemaPatch(this);

            var allSchemaNames = AllSchemaNames();

            DatabaseSchemaGenerator.WriteSql(StoreOptions, allSchemaNames, patch.UpWriter);

            patch.Updates.Apply(this, patch.UpdateDDL);

            foreach (var schemaObject in AllSchemaObjects())
            {
                // Need to override the AutoCreate value here so stuff can actually work
                schemaObject.GenerateSchemaObjectsIfNecessary(AutoCreate.CreateOrUpdate, this, patch);
            }
        }
Example #4
0
        public SchemaPatch ToPatch(bool withSchemas = true)
        {
            var patch = new SchemaPatch();

            if (withSchemas)
            {
                var allSchemaNames = AllSchemaNames();
                DatabaseSchemaGenerator.WriteSql(StoreOptions, allSchemaNames, patch.UpWriter);
            }

            foreach (var schemaObject in AllSchemaObjects())
            {
                schemaObject.WritePatch(this, patch);
            }

            return(patch);
        }
Example #5
0
        public string ToPatch()
        {
            var writer = new StringWriter();

            var allSchemaNames = AllSchemaNames();

            DatabaseSchemaGenerator.WriteSql(allSchemaNames, writer);

            var recorder = new DDLRecorder(writer);

            foreach (var schemaObject in AllSchemaObjects())
            {
                schemaObject.WritePatch(this, recorder);
            }

            return(writer.ToString());
        }
Example #6
0
        public string ToDDL()
        {
            var writer = new StringWriter();

            new SchemaPatch(StoreOptions.DdlRules).WriteTransactionalScript(writer, w =>
            {
                var allSchemaNames = AllSchemaNames();
                DatabaseSchemaGenerator.WriteSql(StoreOptions, allSchemaNames, w);

                foreach (var schemaObject in AllSchemaObjects())
                {
                    schemaObject.WriteSchemaObjects(this, writer);
                }
            });



            return(writer.ToString());
        }
Example #7
0
        public string ToDDL()
        {
            var writer = new StringWriter();

            var allSchemaNames = AllSchemaNames();

            DatabaseSchemaGenerator.WriteSql(allSchemaNames, writer);

            StoreOptions.AllDocumentMappings.Each(x => x.SchemaObjects.WriteSchemaObjects(this, writer));

            if (Events.IsActive && !StoreOptions.AllDocumentMappings.Contains(Events.As <IDocumentMapping>()))
            {
                Events.As <IDocumentMapping>().SchemaObjects.WriteSchemaObjects(this, writer);
            }

            writer.WriteLine(SchemaBuilder.GetSqlScript(StoreOptions.DatabaseSchemaName, "mt_hilo"));

            return(writer.ToString());
        }