Skip to content

ConfigurationOptions

Michal Levý edited this page Nov 1, 2017 · 38 revisions

RoundhousE Configuration Options

Introduction

RoundhousE is extremely configurable. The point is not to constrain someone's use of RH. The defaults are its conventions. It does have quite a few conventions and tries to be a smart little tool.

Barebone

At a minimum you just need to tell RoundhousE your database name. It will deploy to the local sql database server (local) looking for sql script folders in the current directory .\.

rh /d bob

The command above would create a database named bob on the local sql server (default instance) using a trusted connection. If you are using PostgreSQL or MySQL and not in silent mode, it will stop and ask you for the user/password (New in v0.8.5). You can also pass a connection string.

Full Configuration

This is based wholly on the output that you can get if you type rh /?.

This shows how to specify the command followed by a pipe (“|”), the option name and usage. Also notes the default setting. The configuration uses NDesk.Options so you can pass things in with -t --t or /t.

  • -?, --help, -h | Prints out the options.

Main Stuff

  • -d, --db, --database, --databasename=VALUE | REQUIRED: DatabaseName - The database you want to create/migrate.
  • -c, --cs, --connstring, --connectionstring=VALUE | REQUIRED: ConnectionString - As an alternative to ServerName and Database - You can provide an entire connection string instead.
  • -f, --files, --sqlfilesdirectory=VALUE | SqlFilesDirectory - The directory where your SQL scripts are. Defaults to .\.
  • -s, --server, --servername, --instance, --instancename=VALUE | ServerName - The server and instance you would like to run on. (local) and (local)\SQL2008 are both valid values. Defaults to (local).
  • --csa, --connstringadmin, --connectionstringadministration=VALUE | ConnectionStringAdministration - This is used for connecting to master when you may have a different uid and password than normal.
  • --ct, --commandtimeout=VALUE | CommandTimeout - This is the timeout when commands are run. This is not for admin commands or restore. Defaults to 60. New in v0.8.5!
  • --cta, --commandtimeoutadmin=VALUE | CommandTimeoutAdministration - This is the timeout when administration commands are run (except for restore, which has its own). Defaults to 300. New in v0.8.5!
  • --dt, --dbt, --databasetype=VALUE | DatabaseType - Tells RH what type of database it is running on. This is a plugin model. This is the fully qualified name of a class that implements the interface roundhouse.sql.Database, roundhouse. If you have your own assembly, just set it next to rh.exe and set this value appropriately. Defaults to sqlserver which is a synonym for roundhouse.databases.sqlserver.SqlServerDatabase, roundhouse.databases.sqlserver.
  • --env, --environment, --environmentname=VALUE | EnvironmentName - This allows RH to be environment aware and only run scripts that are in a particular environment based on the namingof the script. LOCAL.something**.ENV.**sql would only be run in the LOCAL environment. Defaults to LOCAL.
  • -o, --output, --outputpath=VALUE | OutputPath - This is where everything related to the migration is stored. This includes any backups, all items that ran, permission dumps, logs, etc. Defaults to a special folder, common application data with roundhouse as subdirectory, i.e. C:\ProgramData\ChuckNorris\RoundhousE.

Database Creation/Alter

  • --cds, --createdatabasescript, --createdatabasecustomscript=VALUE | CreateDatabaseCustomScript - This instructs RH to use this script for creating a database instead of the default based on the SQLType. See CustomCreateDatabase for information related to using this.

Versioning

See Versioning

  • -r, --repo, --repositorypath=VALUE | RepositoryPath - The repository. A string that can be anything. Used to track versioning along with the version. Defaults to null.
  • -v, --version=VALUE | Version - Specify the version directly instead of looking in a file. If present, ignores file version options.
  • --vf, --versionfile=VALUE | VersionFile - Either a .XML file, a .DLL or a .TXT file that a version can be resolved from. Defaults to _BuildInfo.xml.
  • --vx, --versionxpath=VALUE | VersionXPath - Works in conjunction with an XML version file. Defaults to //buildInfo/version.

Folder locations

  • --ad, --alterdatabase, --alterdatabasefolder, --alterdatabasefoldername=DatabaseName | AlterDatabaseFolderName - The name of the folder where you keep your alter database scripts. Read up on token replacement. You will want to use {{DatabaseName}} here instead of specifying a database name. Will recurse through subfolders. Defaults to alterDatabase. New in v0.8.5!
  • --racd, --runaftercreatedatabase, --runaftercreatedatabasefolder, --runaftercreatedatabasefoldername=VALUE | RunAfterCreateDatabaseFolderName - The name of the folder where you will keep scripts that ONLY run after a database is created. Will recurse through subfolders. Defaults to runAfterCreateDatabase. New in v0.8.5!
  • --rb, --runbefore, --runbeforeupfolder, --runbeforeupfoldername=VALUE | RunBeforeUpFolderName - The name of the folder where you keep scripts that you want to run before your update scripts. Will recurse through subfolders. Defaults to runBeforeUp. New in v0.8.6
  • -u, --up, --upfolder, --upfoldername=VALUE | UpFolderName - The name of the folder where you keep your update scripts. Will recurse through subfolders. Defaults to up.
  • --rf, --runfirst, --runfirstfolder, --runfirstafterupdatefolder, --runfirstafterupdatefoldername=VALUE | RunFirstAfterUpdateFolderName - The name of the folder where you keep any functions, views, or sprocs that are order dependent. If you have a function that depends on a view, you definitely need the view in this folder. Will recurse through subfolders. Defaults to runFirstAfterUp.
  • --fu, --functions, --functionsfolder, --functionsfoldername=VALUE | FunctionsFolderName - The name of the folder where you keep your functions. Will recurse through subfolders. Defaults to functions.
  • --vw, --views, --viewsfolder, --viewsfoldername=VALUE | ViewsFolderName - The name of the folder where you keep your views. Will recurse through subfolders. Defaults to views.
  • --sp, --sprocs, --sprocsfolder, --sprocsfoldername=VALUE | SprocsFolderName - The name of the folder where you keep your stored procedures. Will recurse through subfolders. Defaults to sprocs.
  • --ix, --indexes, --indexesfolder, --indexesfoldername=VALUE | IndexesFolderName - The name of the folder where you keep your indexes. Will recurse through subfolders. Defaults to indexes. New in v0.8.5!
  • --ra, --runAfterOtherAnyTimeScripts, --runAfterOtherAnyTimeScriptsfolder, --runAfterOtherAnyTimeScriptsfoldername=VALUE | RunAfterOtherAnyTimeScriptsFolderName - The name of the folder where you keep scripts that will be run after all of the other any time scripts complete. Will recurse through subfolders. Defaults to runAfterOtherAnyTimeScripts.
  • -p, --permissions, --permissionsfolder, --permissionsfoldername=VALUE | PermissionsFolderName - The name of the folder where you keep your permissions scripts. Will recurse through subfolders. Defaults to permissions.

RoundhousE Schema/Tables

  • --sc, --schema, --schemaname=VALUE | SchemaName - This is the schema where RH stores it's tables. Once you set this a certain way, do not change this. This is definitely running with scissors and very sharp. I am allowing you to have flexibility, but because this is a knife you can still get cut if you use it wrong. I'm just saying. You've been warned. Defaults to RoundhousE.
  • --vt, --versiontable, --versiontablename=VALUE | VersionTableName - This is the table where RH stores versioning information. Once you set this, do not change this. This is definitely running with scissors and very sharp. Defaults to Version.
  • --srt, --scriptsruntable, --scriptsruntablename=VALUE | ScriptsRunTableName - This is the table where RH stores information about scripts that have been run. Once you set this a certain way, do not change this. This is definitely running with scissors and very sharp. Defaults to ScriptsRun.
  • --sret, --scriptsrunerrorstable, --scriptsrunerrorstablename=VALUE | ScriptsRunErrorsTableName - This is the table where RH stores information about scripts that have been run with errors. Once you set this a certain way, do not change this. This is definitelly running with scissors and very sharp. Defaults to ScriptsRunErrors.

Restore Options

  • --restore | Restore - This instructs RH to do a restore (with the restorefrompath parameter) of a database before running migration scripts. Defaults to false.
  • --rfp, --restorefrom, --restorefrompath=VALUE | RestoreFromPath - This tells the restore where to get to the backed up database. Defaults to null. Required if /restore has been set. NOTE: will try to use Litespeed for the restore if the last two characters of the name are LS (as in DudeLS.bak).
  • --rco, --restoreoptions, --restorecustomoptions=VALUE | RestoreCustomOptions - This provides the restoreany custom options as in MOVE='Somewhere or another'. Take a look at Token Replacement to help out with naming.
  • --rt, --restoretimeout=VALUE | RestoreTimeout - Allows you to specify a restore timeout in seconds. The default is 900 seconds.

Switches

  • --drop | Drop - This instructs RH to remove a database and not run migration scripts. Defaults to false.
  • --dc, --dnc, --donotcreatedatabase | DoNotCreateDatabase - This instructs RH to not create a database if it does not exists. Defaults to false.
  • -w, --warnononetimescriptchanges | WarnOnOneTimeScriptChanges - Instructs RH to execute changed one time scripts (DDL/DML in Up folder) that have previously been run against the database instead of failing. A warning is logged for each one time scripts that is rerun. Defaults to false.
  • --warnandignoreononetimescriptchanges | WarnAndIgnoreOnOneTimeScriptChanges - Instructs RH to ignore and update the hash of changed one time scripts (DDL/DML in Up folder) that have previously been run against the database instead of failing. A warning is logged for each one time scripts that is rerun. Defaults to false.
  • --disableoutput | DisableOutput - Disable output of backups, items ran, permissions dumps, etc. Log files are kept. Useful for example in CI environment. Defaults to False.
  • --silent, --ni, --noninteractive | Silent - tells RH not to ask for any input when it runs. Defaults to false.
  • -t, --trx, --transaction, --wt, --withtransaction | WithTransaction - This instructs RH to run inside of a transaction. Defaults to false.
  • --simple | RecoveryModeSimple - This instructs RH to set the database recovery mode to simple recovery. Only works with SqlServer. Defaults to false.
  • --debug | Debug - This instructs RH to write out all messages. Defaults to false.
  • --runallanytimescripts, --forceanytimescripts | RunAllAnyTimeScripts - This instructs RH to run any time scripts every time it is run. Defaults to false.
  • --disabletokens, --disabletokenreplacement | DisableTokenReplacement - This instructs RH to not perform token replacement {{somename}}. Defaults to false. New in v0.8.5!
  • --searchallinsteadoftraverse, --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. New in v0.8.5!
  • --baseline | Baseline - This instructs RH to create an insert for its recording tables, but not to actually run anything against the database. Use this option if you already have scripts that have been run through other means (and BEFORE you start the new ones).
  • --dryrun | DryRun - This instructs RH to log what would have run, but not to actually run anything against the database. Use this option if you are trying to figure out what RH is going to do.
  • --isuptodate | IsUpToDate - This option prints whether there are any database updates or not, without actually running them. Other output except errors is disabled, to make it easy to use in scripts.
  • --defaultencoding=VALUE | DefaultEncoding - Default encoding to use for loading script file from disk if file doesn't contain BOM. For the list of possible values see the column Name in table listed in .NET Encoding class documentation. Defaults to UTF-8
  • --cf, --configfile, --configurationfile=VALUE | ConfigurationFile - Loads configuration options from a JSON file