Beispiel #1
0
        public void UpdateDataBaseSchema()
        {
            ISchemaHandler handler = this.GetSchemaHandler();
            string         script  = null;

            try
            {
                script = handler.CreateUpdateDDLScript(null);
            }
            catch
            {
                bool throwException = false;
                try
                {
                    handler.CreateDatabase();
                    script = handler.CreateDDLScript();
                }
                catch
                {
                    throwException = true;
                }
                if (throwException)
                {
                    throw;
                }
            }

            if (string.IsNullOrEmpty(script) == false)
            {
                handler.ExecuteDDLScript(script);
            }
        }
Beispiel #2
0
 private static void EnsureDB(ISchemaHandler schemaHandler)
 {
     string script = null;
     if (schemaHandler.DatabaseExists())
     {
         script = schemaHandler.CreateUpdateDDLScript(null);
     }
     else
     {
         schemaHandler.CreateDatabase();
         script = schemaHandler.CreateDDLScript();
     }
     if (!string.IsNullOrEmpty(script))
     {
         schemaHandler.ExecuteDDLScript(script);
     }
 }
Beispiel #3
0
        private static string GenerateScript(ISchemaHandler handler, TextWriter log)
        {
            string ddlScript = string.Empty;

            if (!handler.DatabaseExists())
            {
                TryLogMessage(log, "Creating database script...");
                ddlScript = handler.CreateDDLScript();
            }
            else
            {
                TryLogMessage(log, "Database exists, creating migration script...");
                ddlScript = handler.CreateUpdateDDLScript(
                    new Telerik.OpenAccess.SchemaUpdateProperties());
            }
            return(ddlScript);
        }
Beispiel #4
0
        private static void EnsureDB(ISchemaHandler schemaHandler)
        {
            string script = null;

            if (schemaHandler.DatabaseExists())
            {
                script = schemaHandler.CreateUpdateDDLScript(null);
            }
            else
            {
                schemaHandler.CreateDatabase();
                script = schemaHandler.CreateDDLScript();
            }
            if (!string.IsNullOrEmpty(script))
            {
                schemaHandler.ExecuteDDLScript(script);
            }
        }
Beispiel #5
0
        public void UpdateSchema()
        {
            ISchemaHandler schemaHandler = GetSchemaHandler();
            string         script        = null;

            if (schemaHandler.DatabaseExists())
            {
                script = schemaHandler.CreateUpdateDDLScript(null);
            }
            else
            {
                schemaHandler.CreateDatabase();
                script = schemaHandler.CreateDDLScript();
            }
            if (!string.IsNullOrEmpty(script))
            {
                schemaHandler.ExecuteDDLScript(script);
            }
        }