/// <summary> /// Runs the sql that creates the schema. Works only if the database does support schema (for MySql, use the CreateDatabaseTask instead) /// </summary> public void Execute() { if (!DbConnectionManager.SupportSchemas) { throw new ETLBoxNotSupportedException("This task is not supported!"); } bool schemaExists = new IfSchemaExistsTask(SchemaName) { ConnectionManager = this.ConnectionManager, DisableLogging = true }.Exists(); if (!schemaExists) { new SqlTask(this, Sql).ExecuteNonQuery(); } }
internal void Execute() { if (!DbConnectionManager.SupportSchemas) { throw new NotSupportedException($"This task is not supported with the current connection manager ({ConnectionType})"); } bool schemaExists = new IfSchemaExistsTask(SchemaName) { ConnectionManager = this.ConnectionManager, DisableLogging = true }.Exists(); if (schemaExists && ThrowOnError) { throw new ETLBoxException($"Schema {SchemaName} already exists - can't create the schema!"); } if (!schemaExists) { new SqlTask(this, Sql).ExecuteNonQuery(); } }