Commits

Jake Ginnivan committed 27323ca

Made sure schema cannot be set when database provider doesn't support it

  • Participants
  • Parent commits cd794a1

Comments (0)

Files changed (4)

File src/FunnelWeb.Web/Areas/Admin/Controllers/InstallController.cs

             model.CanConnect = databaseProvider.Value.TryConnect(connectionString, out error);
             model.ConnectionError = error;
             model.ConnectionString = connectionString;
-            model.Schema = schema;
+            model.Schema = databaseProvider.Value.SupportSchema ? schema : null;
             model.DatabaseProviderSupportsSchema = databaseProvider.Value.SupportSchema;
 
             if (model.CanConnect)
 
             ConnectionStringProvider.ConnectionString = provider.Value.DefaultConnectionString;
             ConnectionStringProvider.DatabaseProvider = databaseProvider;
+            if (!provider.Value.SupportSchema)
+                ConnectionStringProvider.Schema = null;
             UpgradeDetector.Reset();
             
             return RedirectToAction("Index");

File src/FunnelWeb/DatabaseDeployer/ApplicationDatabase.cs

 
         public string[] GetCoreExecutedScripts(Func<IDbConnection> connectionFactory)
         {
-            return CreateJournal(connectionFactory, CoreSourceIdentifier, connectionStringProvider.Schema).GetExecutedScripts();
+            var provider = providerLookup[connectionStringProvider.DatabaseProvider.ToLower()];
+
+            return CreateJournal(connectionFactory, CoreSourceIdentifier, provider.SupportSchema ? connectionStringProvider.Schema : null).GetExecutedScripts();
         }
 
         public string[] GetCoreRequiredScripts()
             var results = new List<DatabaseUpgradeResult>();
             
             var provider = providerLookup[connectionStringProvider.DatabaseProvider.ToLower()];
-            var schema = provider.SupportSchema ? connectionStringProvider.Schema : "";
+            var schema = provider.SupportSchema ? connectionStringProvider.Schema : null;
             var connectionFactory = provider.GetConnectionFactory(connectionStringProvider.ConnectionString);
 
             // Upgrade core

File src/FunnelWeb/Settings/ConnectionStringProvider.cs

         {
             get
             {
-                return settings.Get("funnelweb.configuration.database.schema") ?? "dbo";
+                return settings.Get("funnelweb.configuration.database.schema");
             }
             set
             {

File src/FunnelWeb/Settings/SettingsProvider.cs

                 }
             }
 
-            public PropertyInfo Property
-            {
-                get { return property; }
-            }
-
             public object DefaultValue
             {
                 get { return defaultValue; }