Giter Club home page Giter Club logo

roundhouse's Introduction

NOTE: RoundhousE is "abandoned"

RoundhousE is a wonderful tool, and I was one of the main maintainers for a couple of years, as no one else was maintaining it, and it provided great value to me. However, the project has been around for many years, and had begun accruing some technical debt that became tough to work with when trying to introduct new features or refactor.

After giving it some thought, I decided to start from zero, and create a successor to RoundhousE, starting from the ground up on modern .NET (started on .NET 6 in 2021, now on .NET 8), cross-platform, using the latest 3rd party libraries to connect to the various databases, etc. I removed NHibernate as a dependency, as it was only used to create the versioning tables, and seemed like a bit of an overkill, and it was hard to move fast forward technology wise with such a large dependency. Log4net was also replaced with Serilog.

RoundhousE will of course never disappear, and the source code will stay here. But, there is no active development of RoundhousE for now. I continue my journey with the successor, grate. It's now on version 1.6, and considered stable. It's in active development.

Please head over there, and try it out. If should be almost feature-complete with RoundhousE, and should you find anything that's missing, please file an issue, or submit a PR.

Project RoundhousE - Database Change Management done right

CI build status

RoundhousE - Professional Database Management

LICENSE

Apache 2.0 - see docs\legal (just LEGAL in the zip folder)

Documentation

WIKI

INFO

Overview

RoundhousE is an automated database deployment (change management) system that allows you to use your current idioms and gain much more. Currently works with Oracle1, SQL Server (2000/2005/2008/Express), Access1, MySQL, SQLite and PostgreSQL. There are future plans for other databases.

It seeks to solve both maintenance concerns and ease of deployment. We follow some of the same idioms as other database management systems (SQL scripts), but we are different in that we think about future maintenance concerns. We want to always apply certain scripts (anything stateless like functions, views, stored procedures, and permissions), so we don't have to throw everything into our change scripts. This seeks to solves future source control concerns. How sweet is it when you can version the database according to your current source control version?

1) Only on full-framework on Windows, not on Cross-platform .NET Core global tool version.

Getting started with RoundhousE

Downloads

You can download RoundhousE from https://github.com/chucknorris/roundhouse/releases

You can also obtain a copy from the build server at https://ci.appveyor.com/project/chucknorris/roundhouse/build/artifacts.

Gems (Not updated for 0.9.0 and above, sorry)

If you have Ruby 1.8.6+ (and Gems 1.3.7+) installed, you can get the current release of RoundhousE to your machine quickly!

  1. Type gem install roundhouse
  2. Then from anywhere you can type rh [options]

NuGet

With NuGet you can get the current release of RoundhousE to your application quickly!

  1. In Visual Studio Package Manager Console type install-package roundhouse
  2. There is also roundhouse.lib, roundhouse.msbuild, and roundhouse.refreshdatabase

Chocolatey

Chocolatey is like apt-get, but for Windows! This is an alternative method to get the current release of RoundhousE to your machine quickly!

  1. Type cinst roundhouse
  2. Then from anywhere you can type rh [options]

Dotnet core global tool (Windows, Linux, macOS, etc)

  1. Type dotnet tool install -g dotnet-roundhouse
  2. Then from anywhere you can type rh [options]

You can read more about what happens in the background e.g. here: https://natemcmaster.com/blog/2018/05/12/dotnet-global-tools/, but in short, it installs the binaries to your ~/.dotnet/tools folder.

You will need dotnet core installed on your box for this to work. You can get it here: https://dot.net.

Docker: Dotnet core global tool

You can easily integrate RoundhousE in your existing docker infrastructure. Use docker compose, or just pull it down directly and run it. You should probably build upon the image, and add your own customisations, as appropriate. The docker image has the dotnet core global tool distribution of RoundhousE in a Debian 10 Linux base image.

  1. Type docker pull dotnetroundhouse/roundhouse
  2. Type docker run dotnetroundhouse/roundhouse

Source

This is the best way to get to the bleeding edge of what we are doing.

  1. Clone the source down to your machine.
    git clone git://github.com/chucknorris/roundhouse.git
  2. Type cd roundhouse
  3. Type git config core.autocrlf false to leave line endings as they are.
  4. Type git status. You should not see any files to change.
  5. Run build.ps1. NOTE: You must have git on the path (open a regular command line and type git).

Developing

The build system has been using UppercuT, but this will probably not be maintained going forward. We will try to standardize on more "main stream" build tools like MSBuild and Powershell. There are still some remains of UppercuT in the source code (esp. in the build folder), but this is probably going to be removed in the near future.

To work with the command line, you will need the following in your path:

  • MS Build
  • GitVersion (easiest to run choco install gitversion.portable. You are running chocolatey aren't you?)
  • NuGet Command Line (easiest to run choco install nuget.commandline. You are running chocolatey aren't you?)

IMPORTANT

NOTE: If you are looking at the source - please run build.ps1 before opening the solution. It extracts the keywords.txt files needed for ILMerge-ing MySql dlls, and build will complain without them.

REQUIREMENTS

  • .NET Framework 4.6.1 (for the full framework version), or
  • .NET Core 2.1+ (for the dotnet core distribution)
  • SA access to the sql server (for creation or deletion)
  • change access to the database (for everything else)

DONATE

Donations Accepted - If you enjoy using this product or it has saved you time and money in some way, please consider making a donation.
It helps keep to the product updated, pays for site hosting, etc. https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2RA38UKSK6EZU

RELEASE NOTES

Please see releases for the full release logs

Bugfix release

Fixed bug in packaging of dotnet core tool, and another bug with log folder paths and colon in connection string.

Merge-error release fix

Cross-platform dotnet core and dotnet standard ++

Big technological release. RoundhousE now runs on .NET Core in addition to the good, old .NET framework.

Two Bugfixes

After the 0.9.0 release, users identifed two significant bugs. These are fixed in a quick point release.

(See release for the full release notes)

Focus on modernising tooling

RoundhousE has had some catching-up to do tooling-wise. Dependency on .NET 3.5, old, NAnt-based build chain, etc. We are starting this work. It is not done yet, but on its way. Feature-wise not a lot to brag about, but RH.exe should now be able to run on Windows Server 2016 out-of-the-box, because it is no longer dependent on .NET 3.5.

(See release for the full release notes)

Catching up with Pull Requests (See release for the release notes)

OMG!! It's a RoundhousE release!!

It's been a long time coming. I didn't want to get bogged down into writing the perfect release notes, so I am summarizing the last four years of commit history. I hope that no one that contributed feels slighted by my failure to specifically acknowledge your contribution. I intend to do better in the future.

Enhancements

  • Added option to run scripts outside of transaction scope
  • Handle Azure connection strings
  • Properly split files that start with a splitter
  • Respect Transaction flag
  • Improved Logging
  • Added switch --warnandignoreononetimescriptchanges

Bug Fixes

  • Only retry on SQL Connection errors
  • Correctly handle postgres connection disposed error

0.8.6

Enhancements

  • Use git as official repository. (mpareja)
  • Upgrade UpperCut to version 1.4.2. (ferventcoder)
  • Database Restore: use restore specific timeout value. (icetoast - pull #90)
  • Ignore EOL format changes when detecting script changes. (lahma - pull #104)
  • Include SQL Print statements in debug log. (ferventcoder - issue #68)
  • Include statement being run in log when an error occurs. (ferventcoder - issue #66)
  • Added 'runBeforeUp' anytime directory. (cdrexle - pull #51)
  • Support resolving version from a text file. (mpareja - pull #50, pull #55)
  • Add option to turn off copying scripts into 'itemsRan' directory. (lahma - pull #47)
  • WarnOnOneTimeScriptChange will now cause changed one-time scripts to be re-run. (BiggerNoise - pull #35)
  • Upgrade NHibernate to version 3.3.2. (drusellers)
  • Upgrade FubuCore, HtmlTags and StructureMap. (drusellers)

Bug Fixes

  • SQL Batch Parser: handle training comments, single quotes. (mpareja - pull #108)
  • SQL Batch Parser: fix hang. (AndersMalmgren - pull #100)
  • Token Replacer: preserve case for unmatched tokens. (mpareja - pull #65)
  • SQL scripts no longer truncated to 4000 characters. (charoco, ferventcoder - pull #61)
  • Oracle: Fix handling of null values. (rdingwall - pull #59, issue #58)
  • Script File Versioner: fix exception. (Michael Kobaly - issue #68 on Google Code)
  • Only change DB recovery mode if explicitly told to. (ferventcoder - issue #69 on Google Code)
  • Fixed the debug command line switch. (ferventcoder - issue #40)
  • Ensure version 1.2.10 of log4net is used when installing NuGet packages. (ferventcoder - issue #41)
  • Fix: Improve logging of RH exceptions. (torkelo - pull #60)

Breaking Changes

  • RoundhousE will change the DB recover mode if the recoverymode mode option is explicitly set to simple or full. In the past, RoundhousE would default to full but would only ever set the recovery mode while creating/restoring the database. If you depended on RoundhousE to create/restore the database for you and you don't want the database server default to be used, you should specify the recovery mode option.

0.8.5

  • FIX: KeyNotFoundException in NHibernateSessionFactoryBuilder. See [issue 59] (http://code.google.com/p/roundhouse/issues/detail?id=59) for details. (r361)
  • SQLite Support!. See details #21 (r360)
  • PostgreSQL Support! Thanks SiimV! See details #30 (r359)
  • New Configuration Switch! SearchAllSubdirectoriesInsteadOfTraverse - All migrations subfolders are traversed by default and run in order of each folder's scripts. This option runs all items in subfolders at same time. Thanks SiimV! See details #31 (r359)
  • FIX: Transactions not working with restore. See details #26 (r357)
  • FIX: Fixed a nasty bug with SQL Server where it tries to hold a connection (interferes with drop/create mode) and gives a transport error. See details #12 (r357)
  • New Version Resolver! - Script Number Versioning. See details #25 (r356)
  • FIX: Custom create script should split batch statements. See details #22 (r353)
  • New Migrations Folder! RunAfterCreateDatabaseFolder - Runs only one time and only after a database has been created. This works with a limited set of database types at the moment. Please test if you are planning on using. See details #20 (r351)
  • Almost everything is now ilmerged internalized. See details #8 and #15 (r350)
  • FIX: Cannot drop databases with snapshots. See details #13 (r349)
  • Create database custom script can handle file paths. See details #17 (r348)
  • FIX: SQL Server 2000 needs to create all of its tables. See details #18 (r346)
  • RH assemblies are now signed. See details #14 (r342)
  • FIX: Removed the temporary log location. See details #7 (r340)
  • New Configuration Switch! DisableTokenReplacement - Token replacement should be configurable. See issue 56 for details. (r339)
  • FIX: Token replacer should only replace for items it finds. See issue 56 for details. (r339)
  • Possible Breaking Change! File encoding will always try to read files as UTF-8, but fall back to ANSI. You can't go wrong if you encode in ANSI. See issue 39 for details. (r337)
  • Restores are a bit smarter about moving files to a default location when one has not been specified. See details #9 or issue 13 (r336)
  • FIX: Do not run token replacement on empty text. See details #10 (r330)
  • Custom Scripts also run token replacement (r321)
  • New Configuration Switches! Two new switches available - CommandTimeout and CommandTimeoutAdmin! (r329)
  • FIX: Migrate doesn't try to configure log4net now (causes issues w/libraries that do) (r326)
  • New Migrations Folder! Indexes folder now available (r327)
  • New Migrations Folder! AlterDatabase folder now available. See details #6 (r324)
  • FIX: Included sample for Oracle doesn't work. See [issue 55] (http://code.google.com/p/roundhouse/issues/detail?id=55) for details. (r322)
  • Custom Restore Options should use token replacement (r321)
  • MySQL Support!. Thanks Diyan. See details #3 (r320)

0.8.0.300

0.7.0.281

  • Fixed a few issues with using the connection string. You should now be able to only supply the connection string and not server/database as well.

0.7.0.276

  • Fixed a collation issue with RoundhousE id columns in its tracking tables. See [issue 46] (http://code.google.com/p/roundhouse/issues/detail?id=46) for details. (r274)
  • RestoreFromPath can take a relative path. (r269)
  • RH can now upgrade it's internals without user interaction. See [issue 40] (http://code.google.com/p/roundhouse/issues/detail?id=40) for details. (r268)
  • MSBuild / NAnt tasks are deprecated and no longer hooked up. Please use the console and call it from your tasks. (r268)
  • RH has differencing support with NHibernate Schema Generation/Updates (r267 - branch, r268)
  • FluentNhibernate and NHibernate are now being used for the internals (r267 - branch, r268)
  • SMO is deprecated and removed (r203 - branch, r268)
  • Gems and build upgrades, oh my! (r259)
  • SQL2000 to 2005 is now a smooth transition. (r221)
  • Fix: SQL2000 - ScriptsRun now correctly references Version for the foreign key. (r220)
  • Fix: Connection should be initialized before asking the database if it supports ddl transactions. (r215)
  • Fix: Uppercase User names when running with Oracle. (r200)
  • RH has differencing support with RedGate. See sample project for details. (r197)
  • Fix: Scrips run errors now updates version number and path w/out a dependency on scripts run. Allows for it to finish during transactional runs and still capture errors. (r196)
  • Fix: Capture errortastic changes to DDL/DML (up) files in the script run errors table. (r191)
  • Added admin connection string to do administrative tasks. (r190)

Prior Release Notes

Prior releases notes are on the wiki.

CREDITS

UppercuT - Automated Builds (automated build in 10 minutes or less?!) http://projectuppercut.org

roundhouse's People

Contributors

3dbrows avatar alexandermlharris avatar andersmalmgren avatar ashgadala avatar biggernoise avatar blythmeister avatar bptillman avatar charoco avatar chrismissal avatar cmiles74 avatar dependabot[bot] avatar drusellers avatar erikbra avatar erikej avatar ferventcoder avatar icedtoast avatar jonanders avatar koenekelschot avatar lahma avatar macfarmw avatar mmalik76 avatar mmooney avatar mpareja avatar rdingwall avatar reharik avatar s-tarasov avatar seif avatar sicil1ano avatar sliekens avatar vansha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

roundhouse's Issues

run_sql fail, rollback fail, no errorlogging

In the following case, we used RH v0.8.0.332.

We recently had a script that failed. The exception handling in DefaultDatabaseMigrator.cs tries to do database.rollback() and then record_script_in_scripts_run_errors_table(...). In our case, the rollback command also failed, and now we didn't get the logging of the original failure, we only see the error caused by database.rollback().

Our fix to find out what had happend was to pull the code from GIT, v0.8.5 and change the exceptionhandling in DefaultDatabaseMigrator.cs. We did the record_script_in_scripts_run_errors_table(...) before the database.rollback(). Ahh... now we got the error and found out that the script had actually timed out.

I can see that insert_script_run_error(...) fallsback to do logging if database can not be written to, but that dosn't help when the code was never run in the firstplace because database.rollback() failed.

The fix:

                catch (Exception ex)
                {
                    record_script_in_scripts_run_errors_table(script_name, sql_to_run, sql_statement, ex.Message, repository_version, repository_path);
                    database.rollback();
                    database.close_connection();
                    throw;
                }

KeyNotFoundException when trying to use custom DatabaseType

Hi

We are trying to use a custom DatabaseType, inheriting from the SqlServer one.

The problem is that as soon as we specify the custom DatabaseType, we get the following error:

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at roundhouse.infrastructure.persistence.NHibernateSessionFactoryBuilder.build_session_factory(Action`1 additional_function)
2011-12-14 11:36:00,363 [RemoteServerSchedulerClient_Worker-2] ERROR roundhouse - RoundhousE encountered an error. You were running in a transaction though, so the database should be in the state it was in prior to this piece running. This does not include a drop/create or any creation of a database, as those items can not run in a transaction.
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at roundhouse.infrastructure.persistence.NHibernateSessionFactoryBuilder.build_session_factory(Action`1 additional_function)
   at roundhouse.databases.DefaultDatabase`1.set_repository()
   at roundhouse.databases.AdoNetDatabase.open_connection(Boolean with_transaction)
   at roundhouse.migrators.DefaultDatabaseMigrator.open_connection(Boolean with_transaction)
   at roundhouse.runners.RoundhouseMigrationRunner.run()

It seems that currently the possible database types are hardcoded in NHibernateSessionFactoryBuilder.

Is it possible to add a facility to register a new database type?

Connection to oracle: StructureMap exception 207

I'm trying to setup roundhouse for oracle:

rh.exe --connectionstring="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyOracleHost)(PORT=1521))(CONNECT_DATA=(SID=MyOracleSID)));User Id=MyUserId;Password=MyPassword;Persist Security Info=false" -vf=revision.xml -vx=//commit/@revision -env=UNITTEST -ni --runallanytimescripts --dt=roundhouse.databases.oracle

I have installed the oracle client, but I get the following exception:

StructureMap Exception Code: 207
Internal exception while creating Instance 'c9958e7c-cac9-4d25-a47d-d7eae39b882b' of PluginType roundhouse.databases.Database, rh, Version=0.7.0.281, Culture=neutral, PublicKeyToken=null. Check the inner exception for more details.

No innerexception is shown, no logfile is created and no entries are added to the windows event log.

Any ideas?

[Enhancement] Run external tasks after database creation

Is there a way to run an external task, such as aspnet_regsql.exe on a database after it's created? Here's my scenario. We have several systems that have a table that has a foreign key into the aspnet_Users table. Provisioning a new instance would be a little less error prone if there was a way to have RoundhousE create the database, run aspnet_regsql.exe on it, then start creating our tables.

[BUG] ORACLE: Entry_date and Modified_date not filled in in roundhouse_version table

In the roundhouse_version table, on an Oracle database, the columns entry_date and modified_date are not filled in (values are NULL).
The dates in the roundhouse_scriptsrun(errors) tables are filled in correctly.

Because the dates are missing, the check of the latest release sometimes fails. Also it is difficult to check the latest installed version like this (unless you order by id desc)

Can this be fixed?

RoundhousE does not update its own Tables

Bit ironic really :)

We started with an old version of RH on our servers. Now when we get errors, we get the barf that RH cannot insert into the errors table (message is truncated).

Looks like Message field in the ScriptRunErrors table was changed from nvarchar(255) to ntext a while back, but RH doesn't version its own tables so we get the log barf instead of the real error message.

I can take a look at this, unfortunately, it may lead to a state of infinite recursion.

[BUG] ALTER DATABASE with ROLLBACK IMMEDIATE Causes RoundhousE Post Processing Error

I have a script to turn on the "contained database" feature for SQL Server 2012. It needs to put the db in single user mode to get an exclusive lock.

ALTER DATABASE {{DatabaseName}} SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO
-- Set db to be "contained"
ALTER DATABASE {{DatabaseName}} SET CONTAINMENT = PARTIAL WITH ROLLBACK IMMEDIATE;
GO

ALTER DATABASE {{DatabaseName}} SET MULTI_USER WITH ROLLBACK IMMEDIATE;
GO

The script runs fine, but the first thing Roundhouse does after it finishes is try to run a dynamic statement in the db being upgrade with sp_executesql that does an INSERT INTO RoundhousE.ScriptsRun followed by SELECT SCOPE_IDENTITY(). I get the following error:

could not insert: [roundhouse.model.ScriptsRun][SQL: INSERT INTO RoundhousE.ScriptsRun (version_id, script_name, text_of_script, text_hash, one_time_script, entry_date, modified_date, entered_by) VALUES (?, ?, ?, ?, ?, ?, ?, ?); select SCOPE_IDENTITY()]

The process of putting the db in single user mode is closing all open connections and rolling back any open transactions. When I look a SQL trace, the INSERT statement isn't being sent to the db server. I'm guessing Roundhouse is expecting its db connection to be open, but it's not.

I have other ALTER DATABASE scripts in the AlterDatabase folder running before this one that do not generate this error. However, none of them put the db in single user mode or do the rollback immediate.

Altering master database in function scripts

I'm using 0.8.5.0. I have a script in my function folder that calls "use master" and does a few things to the master. I then have a script that gets executed immediately after that in a different file which should alter the database RH was originally running against, but it is not creating my function. RH does not fail or show any error message.

See scripts below. Essentially 0.sql calls "use master", but 1.sql does not call "use OriginalDB" and I don't think it should, as OriginalDB is dynamic based on the connection string I pass in through the command line.

How do I get 1.sql to execute against the database passed in through the connection string? Maybe upgrade RH? Is there a different place I should put 0.sql so that it gets executed in a different context of 1.sql?

Thanks

In functions\0.sql:
sp_configure 'clr enabled', 1
GO
RECONFIGURE
GO

use master;

--drop login

IF EXISTS (
SELECT NAME
FROM master.dbo.syslogins
WHERE NAME = 'SOME-ASSEMBLY'
)
begin
drop login [SOME-ASSEMBLY]
END
GO
--drop asymetric key
IF EXISTS (
SELECT NAME
FROM sys.asymmetric_keys
WHERE NAME = 'SOME-ASYM-KEY'
)
begin
drop asymmetric key [SOME-ASYM-KEY]
END
GO
--create asymetric key
CREATE ASYMMETRIC KEY [SOME-ASYM-KEY]
FROM EXECUTABLE FILE = 'C:\SomePathToSignedAssembly.dll'
GO
--create login
create login [SOME-ASSEMBLY] from asymmetric key [SOME-ASYM-KEY]
GO
--grant external access to new login
grant unsafe assembly to [SOME-ASSEMBLY]
GO

Then in functions\1.sql

IF EXISTS (
SELECT NAME
FROM sysobjects
WHERE NAME = 'SOMEFUNC'
AND type = 'FS'
)
BEGIN
DROP function SOMEFUNC
END
GO

IF EXISTS (
SELECT NAME
FROM sys.assemblies
WHERE NAME = 'SOMEASSEMBLYNAME'
)
BEGIN
DROP assembly SOMEASSEMBLYNAME
END
GO

CREATE ASSEMBLY SOMEASSEMBLYNAME
FROM 'C:\SomePathToSignedAssembly.dll'
WITH PERMISSION_SET = UNSAFE

Go

CREATE Function [dbo].SOMEFUNC
returns datetime
AS EXTERNAL NAME [SOMEASSEMBLYNAME].[SomeNameSpacedClassName].[SOMEFUNC];
GO

OracleParameterCollection exception in insert_version_and_get_version_id()

Happening in version 0.8.5.0.

   Attempting to resolve version from C:\tmp\ddl\clean\_BuildInfo.xml using //buildInfo/version.
MSBUILD : warning : Unable to get version from xml file C:\tmp\ddl\clean\_BuildInfo.xml. File doesn't exist. [C:\tmp\ddl\clean\up.proj]
   Migrating (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE))) from version
   0 to 0.
   Versioning (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE))) database wi
  th version 0 based on .
MSBUILD : error : RoundhousE encountered an error.\r [C:\tmp\ddl\clean\up.proj]
MSBUILD : error : System.ArgumentException: The OracleParameter is already contained by another OracleParameterCollection.\r [C:\tmp\ddl\clean\up.proj]
MSBUILD : error :    at System.Data.OracleClient.OracleParameterCollection.Validate(Int32 index, Object value)\r [C:\tmp\ddl\clean\up.proj]
MSBUILD : error :    at System.Data.OracleClient.OracleParameterCollection.Add(Object value)\r [C:\tmp\ddl\clean\up.proj]
MSBUILD : error :    at roundhouse.databases.AdoNetDatabase.setup_database_command(String sql_to_run, ConnectionType connection_type, IEnumerable`1 parameters)
\r [C:\tmp\ddl\clean\up.proj]
MSBUILD : error :    at roundhouse.databases.AdoNetDatabase.run_command_with(String sql_to_run, ConnectionType connection_type, IList`1 parameters)\r [C:\tmp\d
dl\clean\up.proj]
MSBUILD : error :    at roundhouse.databases.AdoNetDatabase.run_sql(String sql_to_run, ConnectionType connection_type, IList`1 parameters)\r [C:\tmp\ddl\clean\
up.proj]
MSBUILD : error :    at roundhouse.databases.oracle.OracleDatabase.insert_version_and_get_version_id(String repository_path, String repository_version)\r [C:\t
mp\ddl\clean\up.proj]
MSBUILD : error :    at roundhouse.migrators.DefaultDatabaseMigrator.version_the_database(String repository_path, String repository_version)\r [C:\tmp\ddl\clea
n\up.proj]
MSBUILD : error :    at roundhouse.runners.RoundhouseMigrationRunner.run() [C:\tmp\ddl\clean\up.proj]
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018: The "Roundhouse" task failed unexpectedly.\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018: System.ArgumentException: The OracleParameter is already contained by another OracleParameterCollection.\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at System.Data.OracleClient.OracleParameterCollection.Validate(Int32 index, Object value)\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at System.Data.OracleClient.OracleParameterCollection.Add(Object value)\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at roundhouse.databases.AdoNetDatabase.setup_database_command(String sql_to_run, ConnectionType connection_typ
e, IEnumerable`1 parameters)\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at roundhouse.databases.AdoNetDatabase.run_command_with(String sql_to_run, ConnectionType connection_type, ILi
st`1 parameters)\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at roundhouse.databases.AdoNetDatabase.run_sql(String sql_to_run, ConnectionType connection_type, IList`1 para
meters)\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at roundhouse.databases.oracle.OracleDatabase.insert_version_and_get_version_id(String repository_path, String
 repository_version)\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at roundhouse.migrators.DefaultDatabaseMigrator.version_the_database(String repository_path, String repository
_version)\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at roundhouse.runners.RoundhouseMigrationRunner.run()\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at roundhouse.tasks.Roundhouse.run_the_task()\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at roundhouse.tasks.Roundhouse.Microsoft.Build.Framework.ITask.Execute()\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r
C:\tmp\ddl\clean\up.proj(9,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggi
ngContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
Done Building Project "C:\tmp\ddl\clean\up.proj" (default targets) -- FAILED.

Issue with Issue 35 Fix

I think the new behavior is bad. Here is why.

Before the "fix", If you wanted an one-time-script to run again, all you had to do was rename it. If you didn't want it to run, it didn't. Now there is no way of telling RH not to run a modified one-time-script. This will cause loads of problems with some of our existing installs.

I propose we go back to the old behavior where the user has control over which scripts get re-executed. Anyone else?

Here is the information from Issue 35:

"Currently, if you set "warnononetimescriptchanges" true, RH will report the altered script and continue running. It will not attempt to execute the updated script.

This patch changes that behavior so that if you set "warnononetimescriptchanges" true, RH reports script alteration, then runs the updated script and records the new script run information. I think this is far more useful, and I gather from my conversations with Rob, it was the expected behavior.

If you have an objection to me merging this in, please give a shout."

RH MsBuild NuGet Package

After installing the RH msbuild package from nuget I'm unable to build my application. The reason is that the roundhouse.dll contains FluentNHibernate. Here's the error:

error CS0433: The type 'FluentNHibernate.Cfg.Fluently' exists in both '...\Source\packages\FluentNHibernate.1.2.0.712\lib\FluentNHibernate.dll' and '...\Source\packages\roundhouse.msbuild.0.8.0.332\lib\roundhouse.dll'
error CS0433: The type 'FluentNHibernate.Cfg.Db.MsSqlConfiguration' exists in both '...\Source\packages\FluentNHibernate.1.2.0.712\lib\FluentNHibernate.dll' and '...\Source\packages\roundhouse.msbuild.0.8.0.332\lib\roundhouse.dll'

Is it possible to internalize FluentNHibernate in RoundhousE with ILMerge? Or reference the FluentNHibernate NuGet package?

An other possibility is that the nuget package doesn't add the roundhouse.dll and roundhouse.tasks.dll to the references of the project. It should do what the normal rh nuget package does, just a a txt file that can easily be removed.

[Enhancement] SearchAllSubdirectoriesInsteadOfTraverse

SearchAllSubdirectoriesInsteadOfTraverse - Each Migration folder's subdirectories are traversed by default. This option pulls back scripts from the main directory and all subdirectories at once. Defaults to 'false'

Rebase, new baseline script

So we have RH running for some time. We got a lot of up-scripts. Now we reduce the number of upscripts by starting from scratch with a new Baseline script with current state of the database. Easy for new environments or dev environments where we can just delete existing database and recreate with new roundhouse baseline script. Not so easy with staging and production database with data we want to keep. Any thoughts on how to solve this issue?

Once modified anytime scripts continue to be applied

  • Create database scripts, be sure there's a SPROC in the sprocs folder
  • Run Roundhouse, everything runs
  • Run Roundhouse, everything is skipped (SPROC hasn't been modified)
  • modify SPROC file
  • Run Roundhouse, SPROC is executed (as expected)

From now on...

  • Run Roundhouse, SPROC is executed. Expected result is that it is skipped. But for each execution, the script is executed and a new record is placed into the ScriptsRun table

Initial Analysis:
I think that the issue is that the get_current_script_hash() function is returning the first entry from the table and it should be returning the last.

I will poke around with this and see if I can get a patch in for you guys, but I thought I would give you the heads up.

[BUG] Sample deploy does not work with SQL2005

The 0003_AppPermissionsWiring.sql script provided in the sample (sample\db\SQLServer\TestRoundhousE\permissions\0003_AppPermissionsWiring.sql) references a field (is_table_type) that is not yet present in the SQL2005 version of sys.types (it was introduced with SQL2008).

The alias IsTableType does not appear in any other script so removing this column from the script should make the sample compatible with SQL2005

Option to have PRINT output show up in logs

A lot of scripts have debugging-style PRINT statements in them (e.g. usp_GetDate.sql and 003_AppPermissionsWiring.sql from the sample). We need an option to have the output of those PRINT statements show up in console/log output when they're run by RoundhousE.

At least in SQL and Oracle it should just be a matter of handling the InfoMessage event on the connection (it's not on the base class, and I don't know anything about your other databases...) http://www.dotnetcurry.com/ShowArticle.aspx?ID=344

Custom configuration option

Would it be possible to allow custom configuration options, which than can be used by the token replacer.

We have a requirement where Oracle tables and indexes should be created in custom tablespace, but at the moment I have to hardcode them inside the script.
As we want to do installation to multiple customers, all with different naming conventions, we want to parameterize these inside the scripts:

eg: create table test(n number) tablespace {{tabts}}
;

Where tabts is a custom configuration option. The same goes for index tablespaces.

I can cheat a little bit, for example, I use the indexFolderName and specify the index tablespace name to be used.
This means I need to create multiple install scripts, where files will be put in an unknown directory (depends on the name of the tablespace.

Also, sometimes I want to use more than 1 index tablespace name (for partitioned indexes for example).

Currently I do not see a way to work around this, apart from hardcoding the tablespace names

[Enhancement] Refactor Traversal

The directory traversal code is repetitious and obscures important differences in how the various migration directories are handled.

Refactor to an approach that allows the common elements to coalesce and the differences to stand out

Unhandled ArgumentException in KnownFoldersBuilder

Getting this when running from MSBuild and the ServerName property was not set. Revsion 169e773.

StructureMap.StructureMapException was unhandled by user code
  Message=StructureMap Exception Code:  207
Internal exception while creating Instance 'b11c83a7-4593-48f6-a2aa-31c843f44321' of PluginType roundhouse.folders.KnownFolders, roundhouse, Version=0.8.5.0, Culture=neutral, PublicKeyToken=91b86fd44f1f23bc.  Check the inner exception for more details.
  Source=StructureMap
  ErrorCode=207
  StackTrace:
       at StructureMap.Pipeline.LambdaInstance`1.build(Type pluginType, BuildSession session) in c:\code\structuremap\Source\StructureMap\Pipeline\LambdaInstance.cs:line 29
       at StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) in c:\code\structuremap\Source\StructureMap\Pipeline\Instance.cs:line 103
       at StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) in c:\code\structuremap\Source\StructureMap\Pipeline\Instance.cs:line 69
       at StructureMap.Pipeline.ObjectBuilder.ConstructNew(Type pluginType, Instance instance, BuildSession session) in c:\code\structuremap\Source\StructureMap\Pipeline\ObjectBuilder.cs:line 39
       at StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session) in c:\code\structuremap\Source\StructureMap\Pipeline\ObjectBuilder.cs:line 27
       at StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance) in c:\code\structuremap\Source\StructureMap\BuildSession.cs:line 153
       at StructureMap.BuildSession.<>c__DisplayClass3.<.ctor>b__1() in c:\code\structuremap\Source\StructureMap\BuildSession.cs:line 34
       at StructureMap.BuildSession.CreateInstance(Type pluginType) in c:\code\structuremap\Source\StructureMap\BuildSession.cs:line 192
       at StructureMap.Container.GetInstance(Type pluginType) in c:\code\structuremap\Source\StructureMap\Container.cs:line 265
       at StructureMap.Container.GetInstance[T]() in c:\code\structuremap\Source\StructureMap\Container.cs:line 155
       at roundhouse.infrastructure.containers.custom.StructureMapContainer.Resolve[TypeToReturn]() in c:\tmp\chucknorris-roundhouse-169e773\product\roundhouse\infrastructure\containers\custom\StructureMapContainer.cs:line 16
       at roundhouse.infrastructure.containers.Container.get_an_instance_of[TypeToGet]() in c:\tmp\chucknorris-roundhouse-169e773\product\roundhouse\infrastructure\containers\Container.cs:line 17
       at roundhouse.infrastructure.app.ApplicationConfiguraton.initialize_file_log_appender() in c:\tmp\chucknorris-roundhouse-169e773\product\roundhouse\infrastructure.app\ApplicationConfiguraton.cs:line 215
       at roundhouse.infrastructure.app.ApplicationConfiguraton.build_the_container(ConfigurationPropertyHolder configuration_property_holder) in c:\tmp\chucknorris-roundhouse-169e773\product\roundhouse\infrastructure.app\ApplicationConfiguraton.cs:line 154
       at roundhouse.tasks.Roundhouse.run_the_task() in c:\tmp\chucknorris-roundhouse-169e773\product\roundhouse.tasks\Roundhouse.cs:line 149
       at roundhouse.tasks.Roundhouse.Microsoft.Build.Framework.ITask.Execute() in c:\tmp\chucknorris-roundhouse-169e773\product\roundhouse.tasks\Roundhouse.cs:line 30
       at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
       at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
  InnerException: System.ArgumentException
       Message=Illegal characters in path.
       Source=mscorlib
       StackTrace:
            at System.IO.Path.CheckInvalidPathChars(String path)
            at System.IO.Path.GetFileName(String path)
            at System.IO.Path.GetFileNameWithoutExtension(String path)
            at roundhouse.infrastructure.filesystem.WindowsFileSystemAccess.get_file_name_without_extension_from(String file_path) in c:\tmp\chucknorris-roundhouse-169e773\product\roundhouse\infrastructure\filesystem\WindowsFileSystemAccess.cs:line 225
            at roundhouse.infrastructure.app.builders.KnownFoldersBuilder.remove_paths_from(String name, FileSystemAccess file_system) in c:\tmp\chucknorris-roundhouse-169e773\product\roundhouse\infrastructure.app\builders\KnownFoldersBuilder.cs:line 40
            at roundhouse.infrastructure.app.builders.KnownFoldersBuilder.build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder) in c:\tmp\chucknorris-roundhouse-169e773\product\roundhouse\infrastructure.app\builders\KnownFoldersBuilder.cs:line 23
            at roundhouse.infrastructure.app.ApplicationConfiguraton.<>c__DisplayClass5.<build_items_for_container>b__2(IContext context) in c:\tmp\chucknorris-roundhouse-169e773\product\roundhouse\infrastructure.app\ApplicationConfiguraton.cs:line 170
            at StructureMap.Pipeline.LambdaInstance`1.build(Type pluginType, BuildSession session) in c:\code\structuremap\Source\StructureMap\Pipeline\LambdaInstance.cs:line 25
       InnerException: 

(oracle) error when rh inserts a record into its own scriptsrun table

We have one .sql file that rh completely executes but right after rh fails to insert that script's record in the SCRIPTSRUN table (Error is below). However, all other scripts are inserted nicely in that same table and moreover.when I split that .sql file in two, they get both inserted into the table. What is going on here?

2011-11-30 09:32:19,943 [INFO ] - Running 0005_Indexes.sql on localhost - .
2011-11-30 09:32:20,033 [ERROR] - roundhouse.databases.oracle.OracleDatabase with provider System.Data.OracleClient does not provide a facility for recording scripts run at this time.
could not insert: [roundhouse.model.ScriptsRun#5][SQL: INSERT INTO PRODATA_ScriptsRun (version_id, script_name, text_of_script, text_hash, one_time_script, entry_date, modified_date, entered_by, id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)]
2011-11-30 09:32:20,055 [ERROR] - RoundhousE encountered an error.
NHibernate.Exceptions.GenericADOException: could not insert: [roundhouse.model.ScriptsRun#5][SQL: INSERT INTO PRODATA_ScriptsRun (version_id, script_name, text_of_script, text_hash, one_time_script, entry_date, modified_date, entered_by, id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)] ---> System.Data.OracleClient.OracleException: ORA-01461: can bind a LONG value only for insert into a LONG column

at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc)
at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals)
at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciRowidDescriptor& rowidDescriptor)
at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()
at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
--- End of inner exception stack trace ---
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
at NHibernate.Action.EntityInsertAction.Execute()
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at roundhouse.infrastructure.persistence.Repository.save_or_update[T](T item)
at roundhouse.databases.DefaultDatabase`1.insert_script_run(String script_name, String sql_to_run, String sql_to_run_hash, Boolean run_this_script_once, Int64 version_id)
at roundhouse.migrators.DefaultDatabaseMigrator.record_script_in_scripts_run_table(String script_name, String sql_to_run, Boolean run_this_script_once, Int64 version_id)
at roundhouse.migrators.DefaultDatabaseMigrator.run_sql(String sql_to_run, String script_name, Boolean run_this_script_once, Boolean run_this_script_every_time, Int64 version_id, Environment environment, String repository_version, String repository_path, ConnectionType connection_type)
at roundhouse.runners.RoundhouseMigrationRunner.traverse_files_and_run_sql(String directory, Int64 version_id, MigrationsFolder migration_folder, Environment migrating_environment, String repository_version, ConnectionType connection_type)
at roundhouse.runners.RoundhouseMigrationRunner.log_and_traverse(MigrationsFolder folder, Int64 version_id, String new_version, ConnectionType connection_type)
at roundhouse.runners.RoundhouseMigrationRunner.run()

Need a config for using scripts as the version

I have a project, that I would like to use roundhouse on. But it's in subversion, and there are 30-40 databases being updated by the same repository.

The scripts are shared and the structure is shared, but the dll versions are disparate of their various consuming web front ends.

So an xml file per database as to what the version is, would be cumbersome and kind of strange when branching.

My proposition is an alternate versioning scheme where the version you are upgrading to is the highest up script in the directory's serial number. For example if the last script in up is 0181_made_user_change.sql. Then you would be going from version whatever to version 181. So the scripts themselves are the version if you choose a config option.
This makes versioning down much more intuitive. Since the scripts themselves can tell you where you are going to.

I'm working up a pull request for this, but wanted to get thoughts on whether or not it would be appropriate to put in to the main release.

[Enhancement] Change Merge Warning to Debug - Referencing roundhouse.dll gives FluentNHibernate warnings on deploy

Referencing roundhouse dll directly (instead of just running rh.exe) generates constant fluentNhibernate resolution warnings in the log, even with simple upgrades. I am not using Nhibernate and this warning just adds noise.

[WARN]: Had an error building session factory from merged, attempting unmerged. The error:
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

---> FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

---> System.TypeLoadException: Could not load type 'roundhouse.databases.sqlserver.orm.VersionMapping' from assembly 'roundhouse, Version=0.8.5.0, Culture=neutral, PublicKeyToken=91b86fd44f1f23bc'.
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at roundhouse.infrastructure.persistence.NHibernateSessionFactoryBuilder.<>c__DisplayClass1f.<build_session_factory>b__1d(MappingConfiguration m)
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
--- End of inner exception stack trace ---
at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
--- End of inner exception stack trace ---
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
at roundhouse.infrastructure.persistence.NHibernateSessionFactoryBuilder.build_session_factory(Action`1 additional_function)

Re-run any time script after reverting to known-good version following an error

Reproduction:

  1. Run RH to execute a known good sproc.
  2. Brake the sproc (something like a keyword typo) and run RH.
  3. Revert changes and run RH.

Expected:

The sproc should have be re-run but Roundhouse claims it didn't detect any changes. For those of us with Drop-Create scripts, this causes SPs to be dropped and not to be re-created.

[Enhancement] Cache Scripts Run table

When executing a migration, roundhouse constantly has to check the latest version of the script in the scripts run table.

Caching the latest script run information would collapse all of the checks into a single call to the database. For migrations with many unchanged scripts, this should lead to a significant boost in performance.

Running alter database scripts

In Roundhouse 0.7 you cannot run all ALTER DATABASE scripts from within the up folder.
It would be great to introduce an additional folder that allows running these scripts.
Therefore it would be also great to have a way to inject the database name into the script, to be able to change the database name during the build.

Example:

On SQL Server running:
ALTER DATABASE DbName SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE;

results in an exception:

2011-05-24 12:15:32,610 [ERROR] - roundhouse.databases.sqlserver.SqlServerDatabase with provider System.Data.SqlClient does not provide a facility for recording scripts run at this time. could not insert: [roundhouse.model.ScriptsRun][SQL: INSERT INTO RoundhousE.ScriptsRun (version_id, script_name, text_of_script, text_hash, one_time_script, entry_date, modified_date, entered_by) VALUES (?, ?, ?, ?, ?, ?, ?, ?); select SCOPE_IDENTITY()] 2011-05-24 12:15:32,624 [ERROR] - RoundhousE encountered an error. NHibernate.Exceptions.GenericADOException: could not insert: [roundhouse.model.ScriptsRun][SQL: INSERT INTO RoundhousE.ScriptsRun (version_id, script_name, text_of_script, text_hash, one_time_script, entry_date, modified_date, entered_by) VALUES (?, ?, ?, ?, ?, ?, ?, ?); select SCOPE_IDENTITY()] ---> System.Data.SqlClient.SqlException: A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.) at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObje ct stateObj) at System.Data.SqlClient.TdsParserStateObject.WriteSni() at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode) at System.Data.SqlClient.TdsParserStateObject.ExecuteFlush() at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) at NHibernate.Id.IdentityGenerator.InsertSelectDelegate.ExecuteAndExtract(IDbC ommand insert, ISessionImplementor session) at NHibernate.Id.Insert.AbstractReturningDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder) --- End of inner exception stack trace --- at NHibernate.Id.Insert.AbstractReturningDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder) at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] fields, Boolean[] notNull, SqlCommandInfo sql, Object obj, ISessionImplementor session) at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] fields, Object obj, ISessionImplementor session) at NHibernate.Action.EntityIdentityInsertAction.Execute() at NHibernate.Engine.ActionQueue.Execute(IExecutable executable) at NHibernate.Event.Default.AbstractSaveEventListener.PerformSaveOrReplicate(O bject entity, EntityKey key, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) at NHibernate.Event.Default.AbstractSaveEventListener.PerformSave(Object entity, Object id, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Obje ct entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGenerated OrRequestedId(SaveOrUpdateEvent event) at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient (SaveOrUpdateEvent event) at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.PerformSaveOrUpda te(SaveOrUpdateEvent event) at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(Sa veOrUpdateEvent event) at NHibernate.Impl.SessionImpl.FireSaveOrUpdate(SaveOrUpdateEvent event) at NHibernate.Impl.SessionImpl.SaveOrUpdate(Object obj) at roundhouse.infrastructure.persistence.Repository.save_or_update[T](T item) at roundhouse.databases.DefaultDatabase1.insert_script_run(String
script_name, String sql_to_run, String sql_to_run_hash, Boolean
run_this_script_once, Int64 version_id)
at
roundhouse.migrators.DefaultDatabaseMigrator.record_script_in_scripts_run_t able(String
script_name, String sql_to_run, Boolean run_this_script_once, Int64
version_id)
at roundhouse.migrators.DefaultDatabaseMigrator.run_sql(String
sql_to_run, String script_name, Boolean run_this_script_once, Boolean
run_this_script_every_time, Int64 version_id, Environment environment,
String repository_version, String repository_path)
at
roundhouse.runners.RoundhouseMigrationRunner.traverse_files_and_run_sql(Str ing
directory, Int64 version_id, MigrationsFolder migration_folder,
Environment migrating_environment, String repository_version)
at roundhouse.runners.RoundhouseMigrationRunner.run()`

Idea/Suggestion: Exclude Switches

We use two distinct deployment mechanisms:.

  1. During a normal database 'upgrade' deployment we drop all objects (sprocs/views/functions etc through alterDatabase script) and then force RoundhousE to add them. This is working wonderfully.

  2. We also a need to do a 'fresh' database deployment to new environments using RoundhousE.

As part of our weekly build, we carry out an 'upgrade' of our blank master and back it up. This is then placed into the RoundhousE folder structure. This backup is fully up-to-date and requires a simple 'post-restore' script running over it and potentially an environmental specific script.

As it is by design, after the database is restored in, it proceeds to continue in normal mode (as it is intended). In this circumstance it drops everything etc, all of which is both unnecessary and time consuming.

It would be highly beneficial for us, and potentially others, for the ability to exclude certain script types or folders (all to be included by default, unless overridden by this switch.

Cannot create db if RoundhousEFluentDiffingType is InitialDevelopment

(Using roundhouse.lib 0.8.0.332 from nuget.)

Getting this error when running with initialdevelopment on a local database with trusted connection.

INFO: Running RoundhousE v0.8.0.332 against (local) - Settlers.Specs.
INFO: Looking in ......\CP.Settlers.Migrations for scripts to run.

INFO: Setup, Backup, Create/Restore/Drop

INFO: Creating Settlers.Specs database on (local) server if it doesn't exist.
[WARN]: roundhouse.databases.sqlserver.SqlServerDatabase with provider System.Da
ta.SqlClient does not provide a facility for creating a database at this time.
A transport-level error has occurred when sending the request to the server. (pr
ovider: Shared Memory Provider, error: 0 - No process is on the other end of the
pipe.)
[ERROR]: RoundhousE encountered an error.

If I create the db first, RH can drop it but still ends up not being able to recreate.

runAfterCreateDatabase scripts are never ran with custom database create script

Because CREATE DATABASE statement does not return a valid boolean value (like 1) return value from custom create script is always considered as false and thus database is considered as not created.

If one tries to return boolean about success (SELECT 1) the cast will fail in DefaultDatabase. Correct way would be to check if not null and not DbNull.Value, then Convert.ToBoolean().

[Enhancement] Log the SQL command being run when an error occurs

From: https://groups.google.com/forum/#!msg/chucknorrisframework/oXUSEJvrvz4/Fl4W1rAoJDkJ

I understand that if a sql command fails that the command that caused the failure is logged in: RoundhousE.ScriptsRunErrors, however; it would also be nice to have the sql_statement that caused the failure to be written out to the log file so that it is immediately obvious what caused the failure when the user sends the log files from the installation.

I would propose this simple change in DefaultDatabaseMigrator.run_sql:

                   try
                    {
                        database.run_sql(sql_statement, connection_type);
                    }
                    catch (Exception ex)
                    {
                        Log.bound_to(this).log_an_error_event_containing("Error executing command {0} - {1}", script_name, sql_statement); // please add this line
                        database.rollback();

Does this sound reasonable?

DryRun is ignored and databases is upgraded

It appears that the DryRun switch is not actually used anywhere in the codebase. The only place the option is referenced is in Program.cs where the options are scraped from the command line. Am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.