-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renaming PerDirectoryExecution to SearchAllSubdirectoriesInsteadOfTra…
…verse. Upgrade roundhouse.databases.postgresql to newest fnh/nh general cleanup
- Loading branch information
1 parent
1abe28f
commit d67cd30
Showing
23 changed files
with
492 additions
and
507 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
99 changes: 0 additions & 99 deletions
99
product/roundhouse.databases.postgre/PostgreSQLDatabase.cs
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
product/roundhouse.databases.postgre/Properties/AssemblyInfo.cs
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
product/roundhouse.databases.postgre/orm/ScriptsRunErrorMapping.cs
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
product/roundhouse.databases.postgre/orm/ScriptsRunMapping.cs
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
product/roundhouse.databases.postgre/orm/VersionMapping.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
100 changes: 100 additions & 0 deletions
100
product/roundhouse.databases.postgresql/PostgreSQLDatabase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
namespace roundhouse.databases.postgresql | ||
{ | ||
using System; | ||
using infrastructure.app; | ||
using infrastructure.extensions; | ||
using infrastructure.logging; | ||
using Npgsql; | ||
|
||
public class PostgreSQLDatabase : AdoNetDatabase | ||
{ | ||
private readonly PostgreAdoNetProviderResolver postgre_ado_net_provider_resolver; | ||
|
||
public PostgreSQLDatabase() | ||
{ | ||
postgre_ado_net_provider_resolver = new PostgreAdoNetProviderResolver(); | ||
postgre_ado_net_provider_resolver.register_db_provider_factory(); | ||
postgre_ado_net_provider_resolver.enable_loading_from_merged_assembly(); | ||
} | ||
|
||
public override void initialize_connections(ConfigurationPropertyHolder configuration_property_holder) | ||
{ | ||
if (!string.IsNullOrEmpty(connection_string)) | ||
{ | ||
var parts = connection_string.Split(';'); | ||
foreach (var part in parts) | ||
{ | ||
if (string.IsNullOrEmpty(server_name) && (part.to_lower().Contains("server") || part.to_lower().Contains("data source"))) | ||
{ | ||
server_name = part.Substring(part.IndexOf("=") + 1); | ||
} | ||
|
||
if (string.IsNullOrEmpty(database_name) && (part.to_lower().Contains("database") || part.to_lower().Contains("database"))) | ||
{ | ||
database_name = part.Substring(part.IndexOf("=") + 1); | ||
} | ||
} | ||
} | ||
|
||
configuration_property_holder.ConnectionString = connection_string; | ||
|
||
set_provider(); | ||
if (string.IsNullOrEmpty(admin_connection_string)) | ||
{ | ||
var builder = new NpgsqlConnection(connection_string); | ||
admin_connection_string = builder.ConnectionString; | ||
} | ||
configuration_property_holder.ConnectionStringAdmin = admin_connection_string; | ||
} | ||
|
||
public override void set_provider() | ||
{ | ||
provider = "Npgsql"; | ||
} | ||
|
||
public override string create_database_script() | ||
{ | ||
//TODO: Add IF EXISTS condition to CREATE DATABASE | ||
return string.Format( | ||
@"CREATE DATABASE {0};", | ||
database_name); | ||
} | ||
|
||
public override string set_recovery_mode_script(bool simple) | ||
{ | ||
return string.Empty; | ||
} | ||
|
||
public override string restore_database_script(string restore_from_path, string custom_restore_options) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override string delete_database_script() | ||
{ | ||
//TODO: Add IF EXISTS condition to DROP DATABASE | ||
return string.Format( | ||
@"DROP DATABASE {0};", | ||
database_name); | ||
} | ||
|
||
public override void create_or_update_roundhouse_tables() | ||
{ | ||
Log.bound_to(this).log_an_info_event_containing("Creating schema [{0}].", roundhouse_schema_name); | ||
run_sql(TableCreationScripts.create_roundhouse_schema(roundhouse_schema_name), ConnectionType.Default); | ||
Log.bound_to(this).log_an_info_event_containing("Creating table [{0}].", version_table_name); | ||
run_sql(TableCreationScripts.create_roundhouse_version_table(roundhouse_schema_name, version_table_name), ConnectionType.Default); | ||
Log.bound_to(this).log_an_info_event_containing("Creating table [{0}].", scripts_run_table_name); | ||
run_sql(TableCreationScripts.create_roundhouse_scripts_run_table(roundhouse_schema_name, version_table_name, scripts_run_table_name), | ||
ConnectionType.Default); | ||
Log.bound_to(this).log_an_info_event_containing("Creating table [{0}].", scripts_run_errors_table_name); | ||
run_sql(TableCreationScripts.create_roundhouse_scripts_run_errors_table(roundhouse_schema_name, scripts_run_errors_table_name), | ||
ConnectionType.Default); | ||
} | ||
|
||
public override void run_database_specific_tasks() | ||
{ | ||
Log.bound_to(this).log_a_debug_event_containing("PostgreSQL has no database specific tasks. Moving along now..."); | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
product/roundhouse.databases.postgresql/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using System.Runtime.InteropServices; | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
|
||
[assembly: Guid("fe05ae73-d658-47c4-8117-ce0418e2e313")] |
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
product/roundhouse.databases.postgresql/orm/ScriptsRunErrorMapping.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
namespace roundhouse.databases.postgresql.orm | ||
{ | ||
using FluentNHibernate.Mapping; | ||
using infrastructure; | ||
using model; | ||
|
||
public class ScriptsRunErrorMapping : ClassMap<ScriptsRunError> | ||
{ | ||
public ScriptsRunErrorMapping() | ||
{ | ||
HibernateMapping.Schema(ApplicationParameters.CurrentMappings.roundhouse_schema_name); | ||
Table(ApplicationParameters.CurrentMappings.scripts_run_errors_table_name); | ||
Not.LazyLoad(); | ||
HibernateMapping.DefaultAccess.Property(); | ||
HibernateMapping.DefaultCascade.SaveUpdate(); | ||
|
||
Id(x => x.id).Column("id").GeneratedBy.Increment().UnsavedValue(0); | ||
Map(x => x.repository_path); | ||
Map(x => x.version).Length(50); | ||
Map(x => x.script_name); | ||
Map(x => x.text_of_script).CustomSqlType("text"); | ||
Map(x => x.erroneous_part_of_script).CustomSqlType("text"); | ||
Map(x => x.error_message).CustomSqlType("text"); | ||
|
||
//audit | ||
Map(x => x.entry_date); | ||
Map(x => x.modified_date); | ||
Map(x => x.entered_by).Length(50); | ||
} | ||
} | ||
} |
Oops, something went wrong.