From a0a74a20318c362e43097eb11c0cd53e4531e94e Mon Sep 17 00:00:00 2001 From: Abdallah Darwish Date: Sun, 28 May 2023 17:49:07 +0400 Subject: [PATCH 1/3] Test --- .../play/yuniql/yuniql-core/Yuniql.Core.xml | 1137 +++++++++++++++++ yuniql-core/WorkspaceService.cs | 8 +- .../Yuniql.Extensibility.xml | 728 +++++++++++ .../unit-tests/Tests/WorkspaceServiceTests.cs | 46 +- 4 files changed, 1912 insertions(+), 7 deletions(-) create mode 100644 yuniql-core/C:/play/yuniql/yuniql-core/Yuniql.Core.xml create mode 100644 yuniql-extensibility/C:/play/yuniql/yuniql-extensibility/Yuniql.Extensibility.xml diff --git a/yuniql-core/C:/play/yuniql/yuniql-core/Yuniql.Core.xml b/yuniql-core/C:/play/yuniql/yuniql-core/Yuniql.Core.xml new file mode 100644 index 00000000..45826106 --- /dev/null +++ b/yuniql-core/C:/play/yuniql/yuniql-core/Yuniql.Core.xml @@ -0,0 +1,1137 @@ + + + + Yuniql.Core + + + + + Global singleton instance of session configuration + + + + + + + + + + + Returns global singleton instance of session configuration + + + + + Returns true when global configuration has been initiatlized via configurationService.Initialize() + + + + + The directory where yuniql-based migration project is placed. + This is a required property. + + + + + Target database platform. Value can be `sqlserver`,`postgresql`, or `mysql`. + This is a required property. + + + + + The connection string to the target database server. + This is a required property. + + + + + When true, automatically creates database in target database server. + This is defaulted to false. + + + + + Runs migration only up to the version specified in this property. + When Null, it will run upto latest unapplied version. + + + + + The list of token key/value pairs to repair tokens in each script file. + + + + + When you run yuniql verify, it checks if all your versions can be executed without errors. + It runs through all the non-versioned script folders (except _init) and all migration steps that yuninql run takes but without committing the transaction. + All changes are rolledback after a successful verification run. + This is defaulted to false. + + + + + Bulk file values separator to use when parsing CSV bulk import files. + This is defaulted to comma ",". + + + + + The size of each batch when performing bulk load. This may not be used in non-sqlserver platforms. + This is defaulted to 0. + + + + + The time it taks to wait for one commend to execute before it expires and throws error. + Use this prorty to adjust time out when you expect a long running migration execution. + This is defaulted to 30 secs. + + + + + Enrich trace messages with raw sql statements and more verbose diagnostic messages. + Use this when you are investigating some failed migrations. + This is defaulted to false. + + + + + Describes the source of migration applied to target database. + This is defaulted to yuniql-cli. + + + + + Describes the version of source of migration applied to target database. + This is defaulted to yuniql.core assembly version. + + + + + Environment to target when running migration with environment-aware scripts. + See https://github.com/rdagumampan/yuniql/wiki/environment-aware-scripts + + + + + Schema name for schema versions table. + This is defaulted to the target data platform's default schema. + + + + + Table name for schema versions table. + This is defaulted to __yuniql_schema_version in all target data platforms. + + + + + When true, forces to skip the the last failed script file and run from next available script in the failed version + + + + + Transaction mode to use in the migration. Valid options are session, version and statement. + When session, uses single transaction for entire migration run. + When version, each version is executed in one transaction. + When statement, no explicit transaction is created for migration run. + This is defaulted to session. + + + + + When true, migration will fail if the _draft directory is not empty. This option ideal when targeting staging/production environment. + This is defaulted to false. + + + + + When true, action would be executed. This is required when executing potentially damaging actions such as yuniql-erase and yuniql-drop. + This is defaulted to false. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Connection extensions for most common data access methods + + + + + + Opens the connection when its found to be closed. + + A connection. + An active connection. + + + + Execute SQL statement against the active connection and returns number of affected rows. + + An active connection. + The sql statement to execute with the active connection. + Command timeout in seconds. + An active transaction. + Trace service provider where trace messages will be written. + + + + + Executes SQL statement against the active connection and returns single row single column result. + + An active connection. + The sql statement to execute with the active connection. + Command timeout in seconds. + An active transaction. + Trace service provider where trace messages will be written. + + + + + Executes SQL statement against the active connection and returns scalar value in boolean. + + An active connection. + The sql statement to execute with the active connection. + Command timeout in seconds. + An active transaction. + Trace service provider where trace messages will be written. + + + + + Executes SQL statement against the active connection and returns scalar value in string. + + An active connection. + The sql statement to execute with the active connection. + Command timeout in seconds. + An active transaction. + Trace service provider where trace messages will be written. + + + + + Executes SQL statement against the active connection and returns scalar value in object. + + An active connection. + The sql statement to execute with the active connection. + Command timeout in seconds. + An active transaction. + Trace service provider where trace messages will be written. + + + + + Executes SQL statement against the active connection and returns scalar value in string. + + An active connection. + The sql statement to execute with the active connection. + Command timeout in seconds. + An active transaction. + Trace service provider where trace messages will be written. + + + + + Check and test connectivity to target database server. + + + + + Instantiate the ConnectivityChecker using Platform and ConnectionString. + + + + + Checks if we can establish sql/odbc connectivity to database on target server/cluster + + + + + + Checks if we can establish sql/odbc connectivity to database master/catalog on target server/cluster + + + + + + Checks if the service can be pinged + + + + + + Checks if the target port is open + + + + + + Check for connectivity to target server/cluster and database + + + + + Wraps usage of + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Helper class for extracting environment variables. + + + + + + + + + + + Wraps usage of . + + + + + + + + + + + + + + + + + Writes trace information into a text file in the current workspace directory. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Wraps + + + + + Wraps + + + + + Wraps + + + + + Wraps + + + + + Wraps + + + + + Wraps + + + + + Returns list of files in the target environment specific directory + + + + + + + + + Not implemented + + + + + + + + + Return sorted files based on default sort order or using in-placed sorting manifest _manifest.ini + + + + + + + + + Wraps + + + + + Interface for implementing helper class for extracting environment variables. + + + + + Returns the current directory where yuniql is executed from. + + + + + Extract values of environment variable with respect to OS platform. + For Windows, the order of ENV variable search is Machine -> User -> Process. + For Linux, it will always use Process. + + Environment varible name. + Value of the environment variable. + + + + + Opens a text file, reads all the text in the file, and then closes the file. + + Path of the file to be created. + Returns the path of file created. + + + + Opens an embedded text file, reads all the text in the file. + + + + + + + Determines whether the file exists. + + Returns true if file exists. + + + + + Wraps + + + + + Interface for implementing service responsible for accessing target database configuration and executing sql statement batches. + + + + + Returns true when database already exists in the target host. + + Command timeout in seconds. + Returns true when database already exists in the target host. + + + + Creates the database + + Command timeout in seconds. + + + + Returns true when migration version tracking table is already created. + + Schema name for schema versions table. When empty, uses the default schema in the target data platform. + Table name for schema versions table. When empty, uses __yuniql_schema_version. + Command timeout in seconds. + Returns true when version tracking table is already created. + + + + Returns true when custom schema for trackinig table is already created. + + Schema name for schema versions table. When empty, uses the default schema in the target data platform. + Command timeout in seconds. + + + + Creates schema in target databases. + + Schema name for schema versions table. When empty, uses the default schema in the target data platform. + Command timeout in seconds. + + + + Creates migration version tracking table in the target database. + + Schema name for schema versions table. When empty, uses the default schema in the target data platform. + Table name for schema versions table. When empty, uses __yuniql_schema_version. + Command timeout in seconds. + + + + Updates migration version tracking table in the target database.. + + True if target database was updated, otherwise returns false + + + + Returns the latest version applied in the target database. + + Schema name for schema versions table. When empty, uses the default schema in the target data platform. + Table name for schema versions table. When empty, uses __yuniql_schema_version. + Command timeout in seconds. + Returns the latest version applied in the target database. + + + + Returns all versions applied in the target database. + + Schema name for schema versions table. When empty, uses the default schema in the target data platform. + Table name for schema versions table. When empty, uses __yuniql_schema_version. + Command timeout in seconds. + All versions applied in the target database. + + + + Returns all versions applied in the target database. + + Schema name for schema versions table. When empty, uses the default schema in the target data platform. + Table name for schema versions table. When empty, uses __yuniql_schema_version. + Command timeout in seconds. + All versions applied in the target database. + + + + Creates new entry to version tracking table after all versions were successfully executed. + + Connection to target database. Connection will be open automatically. + An active transaction. + Migration version. + Transaction context containg last know failed version information. + Schema name for schema versions table. When empty, uses the default schema in the target data platform. + Table name for schema versions table. When empty, uses __yuniql_schema_version. + Command timeout in seconds. + The source that initiates the migration. This can be yuniql-cli, yuniql-aspnetcore or yuniql-azdevops. + The version of the source that initiates the migration. + The failed script path. + The failed script error. + Additional infromation to describe the version executed. + The duration it takes to complete the version in milliseconds + + + + Executes sql statement to target database. + + Connection to target database. Connection will be open automatically. + The sql statement. + Command timeout in seconds. + An active transaction. + Trace service provider where trace messages will be written to. + + + + + Runs migrations by executing alls scripts in the workspace directory. + + + + + Returns true if the version of target database is equal or greater than local versions + + + + + + + + + Returns the current migration version applied in target database. + + + + + Returns all migration versions applied in the target database + + + + + Runs migrations by executing alls scripts in the workspace directory. + When CSV files are present also run bulk import operations to target database table having same file name. + + + + + Executes erase scripts presentin _erase directory and subdirectories. + + + + + Drops previously deployed database. + + + + + Factory class of creating instance of . + + + + + Create instance of and uses external data services. + When targeting PostgreSql or MySql, this is where you can pass the implementation of and . + + Platform specific data service providing compatible SQL statements and connection objects. + Platform specific service provding support for bulk import of CSV files. + An instance of and uses external data services. + + + + Interface for implementing replacement of tokens in the script using the pattern ${TOKEN_KEY}. + Throws exception and fails the migration when some tokens not replaced due to missing token values passed from the client. + + + + + Runs token replacement process. + + List of token Key/Value pairs. + Raw SQL statement where tokens maybe present. + SQL statement where tokens are successfully replaced. + + + + Interface for implementing service responsible for initializing and managing the local workspace. A local workspace is a directory where yuniql operations are operated from. + + + + + Creates the baseline directory structure in the target workspace path. + + The directory path where workspace structure will be created. + + + + Gets the latest version available in the local workspace. + + The directory path when yuniql operations are executed from. + + + + Creates a new major version migration directory by incrementing the latest major version. + + The directory path where yuniql operations are executed from. + File name of sql file to be created. + The version created in v{Major}.{Minor} format. + + + + Creates a new minor version migration directory by incrementing tha latest version. + + The directory path where yuniql operations are executed from. + File name of sql file to be created. + The version created in v{Major}.{Minor} format. + + + + Validates the baseline directory structure. The following directories are always required to be present in the workspace else the migration would fail. + Required folders are _init, _pre, v0.00, _draft, _post, and _erase. + + The directory path where yuniql operations are executed from. + + + + Representions individual migration version entry. + + + + + Creates new instance of LocalVersion + + + + + Creates new instance of LocalVersion + + The version in format v{Major}.{Minor}. Example v1.01 or v2.00. + The full path of version directory + + + + Returns the major part of version. + + + + + Returns the minor part of version. + + + + + Returns the revision part of version. + + + + + Returns the label part of version. + + + + + Retuns verion in v{Major}.{Minor} format. + Example v0.00 for baseline version. + + + + + Returns the original version name + + + + + Returns the full path of local directory + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Factory class of creating instance of . + + + + + + + + + + + This is a collectible (unloadable) AssemblyLoadContext that loads the dependencies + of the plugin from the plugin's binary directory. + + + + + The location of the plugin binaries + + + + + + + + The Load method override causes all the dependencies present in the plugin's binary directory to get loaded + into the HostAssemblyLoadContext together with the plugin assembly itself. + The Interface assembly must not be present in the plugin's binary directory, otherwise we would + end up with the assembly being loaded twice. Once in the default context and once in the HostAssemblyLoadContext. + + The assembly name to load. + + + + + + + + Global constants used for token replacement in sql statements + + + + + Token for database name value when performing queries in version tracking table + + + + + Token for schema name value when performing queries in version tracking table + + + + + Token for table name value when performing queries in version tracking table + + + + + Token for sequence id value when performing queries in version tracking table + + + + + Token for version value when performing queries in version tracking table + + + + + Token for applied utc date value when performing queries in version tracking table + + + + + Token for applied by user value when performing queries in version tracking table + + + + + Token for applied by tool value when performing queries in version tracking table + + + + + Token for applied by tool version value when performing queries in version tracking table + + + + + Token for status value when performing queries in version tracking table + + + + + Token for duration ms value when performing queries in version tracking table + + + + + Token for directoru checksum when performing queries in version tracking table + + + + + Token for failed script value when performing queries in version tracking table + + + + + Token for failed script error value when performing queries in version tracking table + + + + + Token for additional artifacts value when performing queries in version tracking table + + + + + Global constants for identifying supported database platforms + + + + + SqlServer + + + + + PostgreSql + + + + + MySql + + + + + MariaDB + + + + + Snowflake DW + + + + + Redshift DW + + + + + Oracle + + + + + Replaces tokens in the script using the pattern ${TOKEN_KEY}. + Throws exception and fails the migration when some tokens not replaced due to missing token values passed from the client. + + + + + + + + + + + Global settings for checking the level of trace message to write. + + + + + When true, trace messages will include debug messages. + + + + + Global singleton instance of trace settings + + + + + + + + + + Returns an instance of + + + + + + + Gets the last knwon failed version + + + + + Gets the failed script path. + + + + + Gets the resolution option. + + + + + Gets a value indicating whether failed script path is matched. + + + + + Sets the failed script path as matched. + + + + + + Service responsible for initializing and managing the local workspace. A local workspace is a directory where yuniql operations are executed from. + When user calls yuniql-init, a directory structure is created in the target workspace directory. + + + + + + + + + + + + + + + + + + + + + + + Custom exception thrown within yuniql migration. + + + + + Custom exception thrown within yuniql migration. + + + + + Creates new YuniqlMigrationException. + + The exception message. + + + + Creates new YuniqlMigrationException. + + The exception message. + The exception captured prior to this exception. + + + diff --git a/yuniql-core/WorkspaceService.cs b/yuniql-core/WorkspaceService.cs index e54eb353..ca9fdfc8 100644 --- a/yuniql-core/WorkspaceService.cs +++ b/yuniql-core/WorkspaceService.cs @@ -1,9 +1,9 @@ -using Yuniql.Extensibility; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using Yuniql.Extensibility; namespace Yuniql.Core { @@ -149,7 +149,7 @@ public string IncrementMajorVersion(string workspace, string sqlFileName) { var localVersions = GetLocalVersions(workspace); - var nextMajorVersion = new LocalVersion { Major = localVersions.First().Major + 1, Minor = 0 }; + var nextMajorVersion = new LocalVersion { Major = (localVersions.FirstOrDefault()?.Major ?? -1) + 1, Minor = 0 }; localVersions.Add(nextMajorVersion); string nextVersionPath = Path.Combine(workspace, nextMajorVersion.SemVersion); @@ -171,7 +171,7 @@ public string IncrementMinorVersion(string workspace, string sqlFileName) { var localVersions = GetLocalVersions(workspace); - var nextMinorVersion = new LocalVersion { Major = localVersions.First().Major, Minor = localVersions.First().Minor + 1 }; + var nextMinorVersion = new LocalVersion { Major = localVersions.FirstOrDefault()?.Major ?? 0, Minor = (localVersions.FirstOrDefault()?.Minor ?? -1) + 1 }; localVersions.Add(nextMinorVersion); string nextVersionPath = Path.Combine(workspace, nextMinorVersion.SemVersion); diff --git a/yuniql-extensibility/C:/play/yuniql/yuniql-extensibility/Yuniql.Extensibility.xml b/yuniql-extensibility/C:/play/yuniql/yuniql-extensibility/Yuniql.Extensibility.xml new file mode 100644 index 00000000..3f01710a --- /dev/null +++ b/yuniql-extensibility/C:/play/yuniql/yuniql-extensibility/Yuniql.Extensibility.xml @@ -0,0 +1,728 @@ + + + + Yuniql.Extensibility + + + + + An exception that is thrown when the method cannot parse a row using the specified format. + + + Based on Microsoft.VisualBasic.FileIO.MalformedLineException.MalformedLineException. + + + + + Constructs an exception with a specified message and a line number. + + + + + Constructs an exception with a specified message, a line number, and a reference to the inner exception that is the cause of this exception. + + + + + The line number of the malformed line. + + + + + Parses comma-separated text files. + + + Based on Microsoft.VisualBasic.FileIO.TextFieldParser. + + + + + Constructs a parser from the specified input stream. + + + + + Constructs a parser from the specified input stream with the specified encoding. + + + + + Constructs a parser from the specified input stream with the specified encoding and byte order mark detection option. + + + + + Constructs a parser from the specified input stream with the specified encoding and byte order mark detection option, and optionally leaves the stream open. + + + + + Constructs a parser from the specified input file path. + + + + + Constructs a parser from the specified input file path with the specified encoding. + + + + + Constructs a parser from the specified input file path with the specified encoding and byte order mark detection option. + + + + + Constructs a parser from the specified input text reader. + + + + + True if there are non-empty lines between the current cursor position and the end of the file. + + + + + Reads all fields on the current line, returns them as an array of strings, and advances the cursor to the next line containing data. + + An array of strings that contains field values for the current line, or null if is true. + if the parse of the current line failed + + + + The number of the line that will be returned by (starting at 1), or -1 if there are no more lines. + + + + + Closes the current object. + + + + + Closes and disposes the current object. + + + + + Disposes of the current object. + + true if called from , or false if called from a finalizer + + + + The line that caused the most recent . + + + If no exceptions have been thrown, an empty string is returned. + The property can be used to display the number of the line that caused the exception. + + + + + Returns the number of the line that caused the most recent exception. + + + If no exceptions have been thrown, -1 is returned. + The property can be used to display the number of the line that caused the exception. + Blank lines and comments are not ignored when determining the line number. + + + + + True if this parser should exactly reproduce the behavior of the Microsoft.VisualBasic.FileIO.TextFieldParser. + Defaults to false. + + + + + Defines the separators or separators for a text file. + Default is a comma. + + + This is defined as an array of strings for compatibility with Microsoft.VisualBasic.FileIO.TextFieldParser, + but this parser only supports one single-character separator. + + A separator value is set to a newline character, an empty string, or null. + The separators are set to an array that does not contain exactly one element with exactly one character. + + + + Sets the separator character used by this parser. + Default is a comma. + + The separator character is set to a newline character. + + + + Sets the quote character used by this parser, and also sets the quote escape character to match if it previously matched. + Default is a double quote character. + + The quote character is set to a newline character. + + + + Sets the quote escape character used by this parser. + Default is the same as the quote character, a double quote character. + + The quote escape character is set to a newline character. + + + + Denotes whether fields are enclosed in quotation marks when a CSV file is being parsed. + Defaults to true. + + + + + Indicates whether leading and trailing white space should be trimmed from field values. + Defaults to false. + + + + + Connection information to target database. + + + + + The target database name. + + + + + The host server or database instance in a cluster. + + + + + The port number assigned the database access. + + + + + Metadata information about migration version. + + + + + Unique sequence id for the version. + + + + + The version itself as reflected in the directory structure. + + + + + The date and time in UTC when migration was run. + + + + + The user id used when migration was performed. + + + + + The yuniql client that executed the migration step. + This can be yuniql-cli, yuniql-aspnetcore, yuniql-core, yuniql-azdevops + + + + + The version of client that executed the migration step. + + + + + Additional information that describes the execution of the version + + + + + The status of version execution + + + + + The execution time of the version in milliseconds + + + + + The calculated md5 checksum of the version directory + + + + + The full path of last failed script file + + + + + The error details from the last failed script file + + + + + Extended data to describe the migration version. + + + + + The version of this artifact schema + + + + + Serialized BLOB of all scripts executed in the version. + + + + + Globa default values. + + + + + Default command timeout in seconds. + + + + + Default batch size of bulk load operations. + + + + + Default CSV file values separator. + + + + + Helper class for extracting environment variables. + + + + + Extract values of environment variable with respect to OS platform. + For Windows, the order of ENV variable search is Machine -> User -> Process. + For Linux, it will always use Process. + + Environment varible name. + Value of the environment variable. + + + + Implement this interface to support bulk import on a target database platform or provider. + + + + + Initialize the bulk import service. Sets connection string for future operations. + + Connection string to the target database. + + + + Runs the bulk import process using custom or native APIs in the target database platform. + + An connection to target database. + An active transaction. + Fully qualified path to the CSV file. + Bulk file values separator used in CSV file. When NULL, defaults to command ",". + Size of bacth for bulk load operation. + Command timeout in seconds. + + + + Implement this interface to support a database platform or provider. + + + + + Initialize the bulk import service. Sets connection string for future operations. + + Connection string to the target database. + + + + Returns true if the database platform or version supports Atomic or Transactional DDL operations. + MySql version below 8.0 are known to not support atomic DDL. Other providers like SqlServer, Oracle and PostgreSql + supports rollback of DDL operations should migration failed. + + + + + Returns true if the database platform or version supports multiple databases in the same server instance. + For example, all major RDMS platforms supports this except for Oracle versions older than 12c + + + + + Returns true if the database platform or version supports Schema within the database. + MySql version below 8.0 are known to not support Schema. + + + + + Returns true if the database platform or version supports batch sql statements. + For example, SQL Server uses GO word as default batch terminator while Snowflow uses semicolon (;). + + + + + Returns true if the database supports single MERGE or UPSERT sql statement + + + + + Default schema name for schema versions table. Leave it null if database doesn't support schema. + For example its dbo in SqlServer and public in PostgreSql + + + + + Table name for schema versions table. + When implementing a new platform, its reccommended to use __yuniql_schema_version as default value + + + + + Creates new connection to target database. + + + + + + Creates new connection to master or metadata database. This is used to check if the database exists when --auto-createdb is set to true. + + + + + + Get basic connection information to target database. + + + + + + Breaks down statement using terminator word supported by target database. + For example, SQL Sevrer uses GO to split statements from single file. + + Raw sql statement as extracted from .sql file. + List of statements separated by terminator. + + + + Returns the SQL statement to use for checking if the target database already exists + + + + + Returns the SQL statement to use for creating new database if --auto-createdb flag is set to true. + + + + + Returns the SQL statement to use for dropping existing database + + + + + Returns the SQL statement to use for checking if the target schema already exists + + + + + Returns the SQL statement to use for creating schema if the target database supports schemas. + + + + + + Returns the SQL statement to use for checking target database has been configured for migration tracking. + + + + + Returns the SQL statement to use for checking target database has been configured for migration tracking in yuniql v1.0. + + + + + Returns the SQL statement to use for configuring the migration tracking table. + + + + + Returns the SQL statement to use for getting the latest migration version appplied in the target database. + + + + + Returns the SQL statement to use for getting all versions applied in the target database. + + + + + Returns the SQL statement to use for creating new entry into migration tracking table. + + + + + Returns the SQL statement to use for updating version in migration tracking table. + + + + + Returns the SQL statement to use for merging new entry into migration tracking table. + + + + + Returns true if the version tracking table requires upgrade for this release + + + + + + Returns sql for upgrade the existing version tracking table + + + + + + Try parses error from database specific exception. + + The exc. + The parsed error. + + True, if the parsing was sucessfull otherwise false + + + + + Support for non-transactional flow (when version scripts are not executed in transaction) + + + + + Gets the SQL for insert or update version for non-transactional platform. + + + + + + Implement this interface to write trace information to desired sink or log store. + + + + + When true, debug messages are always written in Trace logs. + + + + + When true, sensitive data is not getting redacted. + + + + + This parameter allows users to define the directory where the log files will be created. + + + + + When false, the log file creation is disabled. + + + + + The directory where log files created will be placed. + + + + + Writes debug messages. + + The message to write. + JSON structured information to support the trace entry. + + + + Writes informational messages. + + The message to write. + JSON structured information to support the trace entry. + + + + Writes warning messages. + + The message to write. + JSON structured information to support the trace entry. + + + + Writes error messages. + + The message to write. + JSON structured information to support the trace entry. + + + + Writes success informational messages. + + The message to write. + JSON structured information to support the trace entry. + + + + Representation of supported platform and versions. + + + + + The name of the database. + + + + + An example string showing how to use the CLI interface. + + + + + The versions of the database. + + + + + A useful link to samples of the database and yuniql in use. + + + + + Outputs a formatted version of the manifest data. + + + + + Extensions to String class + + + + + Returns 6-char fixed lengh string and removed - + + + + + + + Retursn a single qouted string + + + + + + + Returns true when string is enclosed in single quote + + + + + + + Retursn a double qouted string + + + + + + + Returns true when string is enclosed in double quote + + + + + + + Replaces \ with \\ in string + + + + + + + Replaces \\ with \ in string + + + + + + + Returns schema name and object name + + + + + + + + + + + + + + + + + + Returns segments of a file to represent sequence no, schema name and table name + These are the valid file name patterns: 1.myschema.mytable, 01.myschema.mytable, myschema.mytable, 1.mytable, 01.mytable, mytable + If you dont specify the schema, the default schema will derived from specific database platform + + + + + + + + Returns true when string has capital letters + + + + + + + Returns true when all charactercs are capital letters + + + + + + + Returns string without single or double quote enclosure + + + + + + + Returns string with token replaced + + The string where tokens can be present + List of token/value pairs + + + + + Defines the qouting and case behaviour when splitting object and schema + + + + diff --git a/yuniql-tests/unit-tests/Tests/WorkspaceServiceTests.cs b/yuniql-tests/unit-tests/Tests/WorkspaceServiceTests.cs index 8a7faaa4..62cb4b9a 100644 --- a/yuniql-tests/unit-tests/Tests/WorkspaceServiceTests.cs +++ b/yuniql-tests/unit-tests/Tests/WorkspaceServiceTests.cs @@ -1,9 +1,10 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Shouldly; using Yuniql.Core; using Yuniql.Extensibility; -using Shouldly; -using System.IO; namespace Yuniql.UnitTests { @@ -134,7 +135,25 @@ public void Test_Increment_Major_Version() directoryService.Verify(s => s.GetDirectories(workspace, "v*.*")); directoryService.Verify(s => s.CreateDirectory(@$"{workspace}\v1.00")); } + [TestMethod()] + public void Test_Increment_Major_Version_Without_Previous_Version() + { + //arrange + var workspace = @"c:\temp\yuniql"; + var traceService = new Mock(); + var fileService = new Mock(); + var directoryService = new Mock(); + directoryService.Setup(s => s.GetDirectories(workspace, "v*.*")).Returns(Array.Empty()); + //act + var sut = new WorkspaceService(traceService.Object, directoryService.Object, fileService.Object); + var result = sut.IncrementMajorVersion(workspace, sqlFileName: null); + + //assert + result.ShouldBe("v0.00"); + directoryService.Verify(s => s.GetDirectories(workspace, "v*.*")); + directoryService.Verify(s => s.CreateDirectory(@$"{workspace}\v0.00")); + } [TestMethod()] public void Test_Increment_Major_Version_With_Sql_File() @@ -187,6 +206,27 @@ public void Test_Increment_Minor_Version() directoryService.Verify(s => s.CreateDirectory(@$"{workspace}\v0.03")); } + [TestMethod] + public void Test_Increment_Minor_Version_Without_Previous_Version() + { + //arrange + var workspace = @"c:\temp\yuniql"; + var traceService = new Mock(); + var fileService = new Mock(); + + var directoryService = new Mock(); + directoryService.Setup(s => s.GetDirectories(workspace, "v*.*")).Returns(Array.Empty()); + + //act + var sut = new WorkspaceService(traceService.Object, directoryService.Object, fileService.Object); + var result = sut.IncrementMinorVersion(workspace, sqlFileName: null); + + //assert + result.ShouldBe("v0.00"); + directoryService.Verify(s => s.GetDirectories(workspace, "v*.*")); + directoryService.Verify(s => s.CreateDirectory(@$"{workspace}\v0.00")); + } + [TestMethod] public void Test_Increment_Minor_Version_With_Sql_File() { From 6cd94464a6b87a118721f4275487938c4fa0d1cf Mon Sep 17 00:00:00 2001 From: Abdallah Darwish Date: Sun, 28 May 2023 18:12:51 +0400 Subject: [PATCH 2/3] Remove extra file --- .../Yuniql.Extensibility.xml | 728 ------------------ 1 file changed, 728 deletions(-) delete mode 100644 yuniql-extensibility/C:/play/yuniql/yuniql-extensibility/Yuniql.Extensibility.xml diff --git a/yuniql-extensibility/C:/play/yuniql/yuniql-extensibility/Yuniql.Extensibility.xml b/yuniql-extensibility/C:/play/yuniql/yuniql-extensibility/Yuniql.Extensibility.xml deleted file mode 100644 index 3f01710a..00000000 --- a/yuniql-extensibility/C:/play/yuniql/yuniql-extensibility/Yuniql.Extensibility.xml +++ /dev/null @@ -1,728 +0,0 @@ - - - - Yuniql.Extensibility - - - - - An exception that is thrown when the method cannot parse a row using the specified format. - - - Based on Microsoft.VisualBasic.FileIO.MalformedLineException.MalformedLineException. - - - - - Constructs an exception with a specified message and a line number. - - - - - Constructs an exception with a specified message, a line number, and a reference to the inner exception that is the cause of this exception. - - - - - The line number of the malformed line. - - - - - Parses comma-separated text files. - - - Based on Microsoft.VisualBasic.FileIO.TextFieldParser. - - - - - Constructs a parser from the specified input stream. - - - - - Constructs a parser from the specified input stream with the specified encoding. - - - - - Constructs a parser from the specified input stream with the specified encoding and byte order mark detection option. - - - - - Constructs a parser from the specified input stream with the specified encoding and byte order mark detection option, and optionally leaves the stream open. - - - - - Constructs a parser from the specified input file path. - - - - - Constructs a parser from the specified input file path with the specified encoding. - - - - - Constructs a parser from the specified input file path with the specified encoding and byte order mark detection option. - - - - - Constructs a parser from the specified input text reader. - - - - - True if there are non-empty lines between the current cursor position and the end of the file. - - - - - Reads all fields on the current line, returns them as an array of strings, and advances the cursor to the next line containing data. - - An array of strings that contains field values for the current line, or null if is true. - if the parse of the current line failed - - - - The number of the line that will be returned by (starting at 1), or -1 if there are no more lines. - - - - - Closes the current object. - - - - - Closes and disposes the current object. - - - - - Disposes of the current object. - - true if called from , or false if called from a finalizer - - - - The line that caused the most recent . - - - If no exceptions have been thrown, an empty string is returned. - The property can be used to display the number of the line that caused the exception. - - - - - Returns the number of the line that caused the most recent exception. - - - If no exceptions have been thrown, -1 is returned. - The property can be used to display the number of the line that caused the exception. - Blank lines and comments are not ignored when determining the line number. - - - - - True if this parser should exactly reproduce the behavior of the Microsoft.VisualBasic.FileIO.TextFieldParser. - Defaults to false. - - - - - Defines the separators or separators for a text file. - Default is a comma. - - - This is defined as an array of strings for compatibility with Microsoft.VisualBasic.FileIO.TextFieldParser, - but this parser only supports one single-character separator. - - A separator value is set to a newline character, an empty string, or null. - The separators are set to an array that does not contain exactly one element with exactly one character. - - - - Sets the separator character used by this parser. - Default is a comma. - - The separator character is set to a newline character. - - - - Sets the quote character used by this parser, and also sets the quote escape character to match if it previously matched. - Default is a double quote character. - - The quote character is set to a newline character. - - - - Sets the quote escape character used by this parser. - Default is the same as the quote character, a double quote character. - - The quote escape character is set to a newline character. - - - - Denotes whether fields are enclosed in quotation marks when a CSV file is being parsed. - Defaults to true. - - - - - Indicates whether leading and trailing white space should be trimmed from field values. - Defaults to false. - - - - - Connection information to target database. - - - - - The target database name. - - - - - The host server or database instance in a cluster. - - - - - The port number assigned the database access. - - - - - Metadata information about migration version. - - - - - Unique sequence id for the version. - - - - - The version itself as reflected in the directory structure. - - - - - The date and time in UTC when migration was run. - - - - - The user id used when migration was performed. - - - - - The yuniql client that executed the migration step. - This can be yuniql-cli, yuniql-aspnetcore, yuniql-core, yuniql-azdevops - - - - - The version of client that executed the migration step. - - - - - Additional information that describes the execution of the version - - - - - The status of version execution - - - - - The execution time of the version in milliseconds - - - - - The calculated md5 checksum of the version directory - - - - - The full path of last failed script file - - - - - The error details from the last failed script file - - - - - Extended data to describe the migration version. - - - - - The version of this artifact schema - - - - - Serialized BLOB of all scripts executed in the version. - - - - - Globa default values. - - - - - Default command timeout in seconds. - - - - - Default batch size of bulk load operations. - - - - - Default CSV file values separator. - - - - - Helper class for extracting environment variables. - - - - - Extract values of environment variable with respect to OS platform. - For Windows, the order of ENV variable search is Machine -> User -> Process. - For Linux, it will always use Process. - - Environment varible name. - Value of the environment variable. - - - - Implement this interface to support bulk import on a target database platform or provider. - - - - - Initialize the bulk import service. Sets connection string for future operations. - - Connection string to the target database. - - - - Runs the bulk import process using custom or native APIs in the target database platform. - - An connection to target database. - An active transaction. - Fully qualified path to the CSV file. - Bulk file values separator used in CSV file. When NULL, defaults to command ",". - Size of bacth for bulk load operation. - Command timeout in seconds. - - - - Implement this interface to support a database platform or provider. - - - - - Initialize the bulk import service. Sets connection string for future operations. - - Connection string to the target database. - - - - Returns true if the database platform or version supports Atomic or Transactional DDL operations. - MySql version below 8.0 are known to not support atomic DDL. Other providers like SqlServer, Oracle and PostgreSql - supports rollback of DDL operations should migration failed. - - - - - Returns true if the database platform or version supports multiple databases in the same server instance. - For example, all major RDMS platforms supports this except for Oracle versions older than 12c - - - - - Returns true if the database platform or version supports Schema within the database. - MySql version below 8.0 are known to not support Schema. - - - - - Returns true if the database platform or version supports batch sql statements. - For example, SQL Server uses GO word as default batch terminator while Snowflow uses semicolon (;). - - - - - Returns true if the database supports single MERGE or UPSERT sql statement - - - - - Default schema name for schema versions table. Leave it null if database doesn't support schema. - For example its dbo in SqlServer and public in PostgreSql - - - - - Table name for schema versions table. - When implementing a new platform, its reccommended to use __yuniql_schema_version as default value - - - - - Creates new connection to target database. - - - - - - Creates new connection to master or metadata database. This is used to check if the database exists when --auto-createdb is set to true. - - - - - - Get basic connection information to target database. - - - - - - Breaks down statement using terminator word supported by target database. - For example, SQL Sevrer uses GO to split statements from single file. - - Raw sql statement as extracted from .sql file. - List of statements separated by terminator. - - - - Returns the SQL statement to use for checking if the target database already exists - - - - - Returns the SQL statement to use for creating new database if --auto-createdb flag is set to true. - - - - - Returns the SQL statement to use for dropping existing database - - - - - Returns the SQL statement to use for checking if the target schema already exists - - - - - Returns the SQL statement to use for creating schema if the target database supports schemas. - - - - - - Returns the SQL statement to use for checking target database has been configured for migration tracking. - - - - - Returns the SQL statement to use for checking target database has been configured for migration tracking in yuniql v1.0. - - - - - Returns the SQL statement to use for configuring the migration tracking table. - - - - - Returns the SQL statement to use for getting the latest migration version appplied in the target database. - - - - - Returns the SQL statement to use for getting all versions applied in the target database. - - - - - Returns the SQL statement to use for creating new entry into migration tracking table. - - - - - Returns the SQL statement to use for updating version in migration tracking table. - - - - - Returns the SQL statement to use for merging new entry into migration tracking table. - - - - - Returns true if the version tracking table requires upgrade for this release - - - - - - Returns sql for upgrade the existing version tracking table - - - - - - Try parses error from database specific exception. - - The exc. - The parsed error. - - True, if the parsing was sucessfull otherwise false - - - - - Support for non-transactional flow (when version scripts are not executed in transaction) - - - - - Gets the SQL for insert or update version for non-transactional platform. - - - - - - Implement this interface to write trace information to desired sink or log store. - - - - - When true, debug messages are always written in Trace logs. - - - - - When true, sensitive data is not getting redacted. - - - - - This parameter allows users to define the directory where the log files will be created. - - - - - When false, the log file creation is disabled. - - - - - The directory where log files created will be placed. - - - - - Writes debug messages. - - The message to write. - JSON structured information to support the trace entry. - - - - Writes informational messages. - - The message to write. - JSON structured information to support the trace entry. - - - - Writes warning messages. - - The message to write. - JSON structured information to support the trace entry. - - - - Writes error messages. - - The message to write. - JSON structured information to support the trace entry. - - - - Writes success informational messages. - - The message to write. - JSON structured information to support the trace entry. - - - - Representation of supported platform and versions. - - - - - The name of the database. - - - - - An example string showing how to use the CLI interface. - - - - - The versions of the database. - - - - - A useful link to samples of the database and yuniql in use. - - - - - Outputs a formatted version of the manifest data. - - - - - Extensions to String class - - - - - Returns 6-char fixed lengh string and removed - - - - - - - - Retursn a single qouted string - - - - - - - Returns true when string is enclosed in single quote - - - - - - - Retursn a double qouted string - - - - - - - Returns true when string is enclosed in double quote - - - - - - - Replaces \ with \\ in string - - - - - - - Replaces \\ with \ in string - - - - - - - Returns schema name and object name - - - - - - - - - - - - - - - - - - Returns segments of a file to represent sequence no, schema name and table name - These are the valid file name patterns: 1.myschema.mytable, 01.myschema.mytable, myschema.mytable, 1.mytable, 01.mytable, mytable - If you dont specify the schema, the default schema will derived from specific database platform - - - - - - - - Returns true when string has capital letters - - - - - - - Returns true when all charactercs are capital letters - - - - - - - Returns string without single or double quote enclosure - - - - - - - Returns string with token replaced - - The string where tokens can be present - List of token/value pairs - - - - - Defines the qouting and case behaviour when splitting object and schema - - - - From 64a7539156e3b3ae77f39c4fce6a366e70f52a34 Mon Sep 17 00:00:00 2001 From: Abdallah Darwish Date: Sun, 28 May 2023 18:15:09 +0400 Subject: [PATCH 3/3] More extra files --- .../play/yuniql/yuniql-core/Yuniql.Core.xml | 1137 ----------------- 1 file changed, 1137 deletions(-) delete mode 100644 yuniql-core/C:/play/yuniql/yuniql-core/Yuniql.Core.xml diff --git a/yuniql-core/C:/play/yuniql/yuniql-core/Yuniql.Core.xml b/yuniql-core/C:/play/yuniql/yuniql-core/Yuniql.Core.xml deleted file mode 100644 index 45826106..00000000 --- a/yuniql-core/C:/play/yuniql/yuniql-core/Yuniql.Core.xml +++ /dev/null @@ -1,1137 +0,0 @@ - - - - Yuniql.Core - - - - - Global singleton instance of session configuration - - - - - - - - - - - Returns global singleton instance of session configuration - - - - - Returns true when global configuration has been initiatlized via configurationService.Initialize() - - - - - The directory where yuniql-based migration project is placed. - This is a required property. - - - - - Target database platform. Value can be `sqlserver`,`postgresql`, or `mysql`. - This is a required property. - - - - - The connection string to the target database server. - This is a required property. - - - - - When true, automatically creates database in target database server. - This is defaulted to false. - - - - - Runs migration only up to the version specified in this property. - When Null, it will run upto latest unapplied version. - - - - - The list of token key/value pairs to repair tokens in each script file. - - - - - When you run yuniql verify, it checks if all your versions can be executed without errors. - It runs through all the non-versioned script folders (except _init) and all migration steps that yuninql run takes but without committing the transaction. - All changes are rolledback after a successful verification run. - This is defaulted to false. - - - - - Bulk file values separator to use when parsing CSV bulk import files. - This is defaulted to comma ",". - - - - - The size of each batch when performing bulk load. This may not be used in non-sqlserver platforms. - This is defaulted to 0. - - - - - The time it taks to wait for one commend to execute before it expires and throws error. - Use this prorty to adjust time out when you expect a long running migration execution. - This is defaulted to 30 secs. - - - - - Enrich trace messages with raw sql statements and more verbose diagnostic messages. - Use this when you are investigating some failed migrations. - This is defaulted to false. - - - - - Describes the source of migration applied to target database. - This is defaulted to yuniql-cli. - - - - - Describes the version of source of migration applied to target database. - This is defaulted to yuniql.core assembly version. - - - - - Environment to target when running migration with environment-aware scripts. - See https://github.com/rdagumampan/yuniql/wiki/environment-aware-scripts - - - - - Schema name for schema versions table. - This is defaulted to the target data platform's default schema. - - - - - Table name for schema versions table. - This is defaulted to __yuniql_schema_version in all target data platforms. - - - - - When true, forces to skip the the last failed script file and run from next available script in the failed version - - - - - Transaction mode to use in the migration. Valid options are session, version and statement. - When session, uses single transaction for entire migration run. - When version, each version is executed in one transaction. - When statement, no explicit transaction is created for migration run. - This is defaulted to session. - - - - - When true, migration will fail if the _draft directory is not empty. This option ideal when targeting staging/production environment. - This is defaulted to false. - - - - - When true, action would be executed. This is required when executing potentially damaging actions such as yuniql-erase and yuniql-drop. - This is defaulted to false. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Connection extensions for most common data access methods - - - - - - Opens the connection when its found to be closed. - - A connection. - An active connection. - - - - Execute SQL statement against the active connection and returns number of affected rows. - - An active connection. - The sql statement to execute with the active connection. - Command timeout in seconds. - An active transaction. - Trace service provider where trace messages will be written. - - - - - Executes SQL statement against the active connection and returns single row single column result. - - An active connection. - The sql statement to execute with the active connection. - Command timeout in seconds. - An active transaction. - Trace service provider where trace messages will be written. - - - - - Executes SQL statement against the active connection and returns scalar value in boolean. - - An active connection. - The sql statement to execute with the active connection. - Command timeout in seconds. - An active transaction. - Trace service provider where trace messages will be written. - - - - - Executes SQL statement against the active connection and returns scalar value in string. - - An active connection. - The sql statement to execute with the active connection. - Command timeout in seconds. - An active transaction. - Trace service provider where trace messages will be written. - - - - - Executes SQL statement against the active connection and returns scalar value in object. - - An active connection. - The sql statement to execute with the active connection. - Command timeout in seconds. - An active transaction. - Trace service provider where trace messages will be written. - - - - - Executes SQL statement against the active connection and returns scalar value in string. - - An active connection. - The sql statement to execute with the active connection. - Command timeout in seconds. - An active transaction. - Trace service provider where trace messages will be written. - - - - - Check and test connectivity to target database server. - - - - - Instantiate the ConnectivityChecker using Platform and ConnectionString. - - - - - Checks if we can establish sql/odbc connectivity to database on target server/cluster - - - - - - Checks if we can establish sql/odbc connectivity to database master/catalog on target server/cluster - - - - - - Checks if the service can be pinged - - - - - - Checks if the target port is open - - - - - - Check for connectivity to target server/cluster and database - - - - - Wraps usage of - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Helper class for extracting environment variables. - - - - - - - - - - - Wraps usage of . - - - - - - - - - - - - - - - - - Writes trace information into a text file in the current workspace directory. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wraps - - - - - Wraps - - - - - Wraps - - - - - Wraps - - - - - Wraps - - - - - Wraps - - - - - Returns list of files in the target environment specific directory - - - - - - - - - Not implemented - - - - - - - - - Return sorted files based on default sort order or using in-placed sorting manifest _manifest.ini - - - - - - - - - Wraps - - - - - Interface for implementing helper class for extracting environment variables. - - - - - Returns the current directory where yuniql is executed from. - - - - - Extract values of environment variable with respect to OS platform. - For Windows, the order of ENV variable search is Machine -> User -> Process. - For Linux, it will always use Process. - - Environment varible name. - Value of the environment variable. - - - - - Opens a text file, reads all the text in the file, and then closes the file. - - Path of the file to be created. - Returns the path of file created. - - - - Opens an embedded text file, reads all the text in the file. - - - - - - - Determines whether the file exists. - - Returns true if file exists. - - - - - Wraps - - - - - Interface for implementing service responsible for accessing target database configuration and executing sql statement batches. - - - - - Returns true when database already exists in the target host. - - Command timeout in seconds. - Returns true when database already exists in the target host. - - - - Creates the database - - Command timeout in seconds. - - - - Returns true when migration version tracking table is already created. - - Schema name for schema versions table. When empty, uses the default schema in the target data platform. - Table name for schema versions table. When empty, uses __yuniql_schema_version. - Command timeout in seconds. - Returns true when version tracking table is already created. - - - - Returns true when custom schema for trackinig table is already created. - - Schema name for schema versions table. When empty, uses the default schema in the target data platform. - Command timeout in seconds. - - - - Creates schema in target databases. - - Schema name for schema versions table. When empty, uses the default schema in the target data platform. - Command timeout in seconds. - - - - Creates migration version tracking table in the target database. - - Schema name for schema versions table. When empty, uses the default schema in the target data platform. - Table name for schema versions table. When empty, uses __yuniql_schema_version. - Command timeout in seconds. - - - - Updates migration version tracking table in the target database.. - - True if target database was updated, otherwise returns false - - - - Returns the latest version applied in the target database. - - Schema name for schema versions table. When empty, uses the default schema in the target data platform. - Table name for schema versions table. When empty, uses __yuniql_schema_version. - Command timeout in seconds. - Returns the latest version applied in the target database. - - - - Returns all versions applied in the target database. - - Schema name for schema versions table. When empty, uses the default schema in the target data platform. - Table name for schema versions table. When empty, uses __yuniql_schema_version. - Command timeout in seconds. - All versions applied in the target database. - - - - Returns all versions applied in the target database. - - Schema name for schema versions table. When empty, uses the default schema in the target data platform. - Table name for schema versions table. When empty, uses __yuniql_schema_version. - Command timeout in seconds. - All versions applied in the target database. - - - - Creates new entry to version tracking table after all versions were successfully executed. - - Connection to target database. Connection will be open automatically. - An active transaction. - Migration version. - Transaction context containg last know failed version information. - Schema name for schema versions table. When empty, uses the default schema in the target data platform. - Table name for schema versions table. When empty, uses __yuniql_schema_version. - Command timeout in seconds. - The source that initiates the migration. This can be yuniql-cli, yuniql-aspnetcore or yuniql-azdevops. - The version of the source that initiates the migration. - The failed script path. - The failed script error. - Additional infromation to describe the version executed. - The duration it takes to complete the version in milliseconds - - - - Executes sql statement to target database. - - Connection to target database. Connection will be open automatically. - The sql statement. - Command timeout in seconds. - An active transaction. - Trace service provider where trace messages will be written to. - - - - - Runs migrations by executing alls scripts in the workspace directory. - - - - - Returns true if the version of target database is equal or greater than local versions - - - - - - - - - Returns the current migration version applied in target database. - - - - - Returns all migration versions applied in the target database - - - - - Runs migrations by executing alls scripts in the workspace directory. - When CSV files are present also run bulk import operations to target database table having same file name. - - - - - Executes erase scripts presentin _erase directory and subdirectories. - - - - - Drops previously deployed database. - - - - - Factory class of creating instance of . - - - - - Create instance of and uses external data services. - When targeting PostgreSql or MySql, this is where you can pass the implementation of and . - - Platform specific data service providing compatible SQL statements and connection objects. - Platform specific service provding support for bulk import of CSV files. - An instance of and uses external data services. - - - - Interface for implementing replacement of tokens in the script using the pattern ${TOKEN_KEY}. - Throws exception and fails the migration when some tokens not replaced due to missing token values passed from the client. - - - - - Runs token replacement process. - - List of token Key/Value pairs. - Raw SQL statement where tokens maybe present. - SQL statement where tokens are successfully replaced. - - - - Interface for implementing service responsible for initializing and managing the local workspace. A local workspace is a directory where yuniql operations are operated from. - - - - - Creates the baseline directory structure in the target workspace path. - - The directory path where workspace structure will be created. - - - - Gets the latest version available in the local workspace. - - The directory path when yuniql operations are executed from. - - - - Creates a new major version migration directory by incrementing the latest major version. - - The directory path where yuniql operations are executed from. - File name of sql file to be created. - The version created in v{Major}.{Minor} format. - - - - Creates a new minor version migration directory by incrementing tha latest version. - - The directory path where yuniql operations are executed from. - File name of sql file to be created. - The version created in v{Major}.{Minor} format. - - - - Validates the baseline directory structure. The following directories are always required to be present in the workspace else the migration would fail. - Required folders are _init, _pre, v0.00, _draft, _post, and _erase. - - The directory path where yuniql operations are executed from. - - - - Representions individual migration version entry. - - - - - Creates new instance of LocalVersion - - - - - Creates new instance of LocalVersion - - The version in format v{Major}.{Minor}. Example v1.01 or v2.00. - The full path of version directory - - - - Returns the major part of version. - - - - - Returns the minor part of version. - - - - - Returns the revision part of version. - - - - - Returns the label part of version. - - - - - Retuns verion in v{Major}.{Minor} format. - Example v0.00 for baseline version. - - - - - Returns the original version name - - - - - Returns the full path of local directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Factory class of creating instance of . - - - - - - - - - - - This is a collectible (unloadable) AssemblyLoadContext that loads the dependencies - of the plugin from the plugin's binary directory. - - - - - The location of the plugin binaries - - - - - - - - The Load method override causes all the dependencies present in the plugin's binary directory to get loaded - into the HostAssemblyLoadContext together with the plugin assembly itself. - The Interface assembly must not be present in the plugin's binary directory, otherwise we would - end up with the assembly being loaded twice. Once in the default context and once in the HostAssemblyLoadContext. - - The assembly name to load. - - - - - - - - Global constants used for token replacement in sql statements - - - - - Token for database name value when performing queries in version tracking table - - - - - Token for schema name value when performing queries in version tracking table - - - - - Token for table name value when performing queries in version tracking table - - - - - Token for sequence id value when performing queries in version tracking table - - - - - Token for version value when performing queries in version tracking table - - - - - Token for applied utc date value when performing queries in version tracking table - - - - - Token for applied by user value when performing queries in version tracking table - - - - - Token for applied by tool value when performing queries in version tracking table - - - - - Token for applied by tool version value when performing queries in version tracking table - - - - - Token for status value when performing queries in version tracking table - - - - - Token for duration ms value when performing queries in version tracking table - - - - - Token for directoru checksum when performing queries in version tracking table - - - - - Token for failed script value when performing queries in version tracking table - - - - - Token for failed script error value when performing queries in version tracking table - - - - - Token for additional artifacts value when performing queries in version tracking table - - - - - Global constants for identifying supported database platforms - - - - - SqlServer - - - - - PostgreSql - - - - - MySql - - - - - MariaDB - - - - - Snowflake DW - - - - - Redshift DW - - - - - Oracle - - - - - Replaces tokens in the script using the pattern ${TOKEN_KEY}. - Throws exception and fails the migration when some tokens not replaced due to missing token values passed from the client. - - - - - - - - - - - Global settings for checking the level of trace message to write. - - - - - When true, trace messages will include debug messages. - - - - - Global singleton instance of trace settings - - - - - - - - - - Returns an instance of - - - - - - - Gets the last knwon failed version - - - - - Gets the failed script path. - - - - - Gets the resolution option. - - - - - Gets a value indicating whether failed script path is matched. - - - - - Sets the failed script path as matched. - - - - - - Service responsible for initializing and managing the local workspace. A local workspace is a directory where yuniql operations are executed from. - When user calls yuniql-init, a directory structure is created in the target workspace directory. - - - - - - - - - - - - - - - - - - - - - - - Custom exception thrown within yuniql migration. - - - - - Custom exception thrown within yuniql migration. - - - - - Creates new YuniqlMigrationException. - - The exception message. - - - - Creates new YuniqlMigrationException. - - The exception message. - The exception captured prior to this exception. - - -