Nucleus .Net Core CMS

DataProviderMigration Class

Namespace: Nucleus.Data.Common
Assembly: Nucleus.Data.Common.dll
Provides a migration implementation for the database provider specified by T.

Properties

SchemaScriptsNamespaces Property

Namespace of the embedded schema scripts.
Remarks
The default value for SchemaScriptsNamespace is the namespace of the class which inherits this class, followed by the database type, or 'Migrations' for database-agnostic screens, with a ".Scripts." suffix. Add your scripts to the DataProvider/database-type/scripts folder where database-type is 'Migrations', or the name of the data provider that the script is for (Sqlite, MySql, SqlServer or PostgreSql). Scripts must have a ".sql" extension or a ".json" extension. This value is not case-sensitive.

SchemaScriptsAssembly Property

Identifies the assembly which contains embedded database migration scripts. The default value is the assembly which contains your DataProviderMigration implementation.

SchemaScripts Property

Retrieves a list of embedded data migration scripts.

Methods

CheckDatabaseSchema

CheckDatabaseSchema ()
Compare the stored schema version from the database with the versions of the available schema scripts retrieved by .SchemaScripts. If any have not been applied, apply them in order (sorted by version, lowest-to-highest)

GetSchemaVersion (String) Method

GetSchemaVersion (String schemaName)
Retrieve the version number of the latest schema update that has been applied for the specified schema name.
Parameters
Name Type
schemaName String
Remarks
If no schema entry exists for the specified schema name, this function returns version 0.0.0.0.

RunDatabaseScripts (String,Version,IList<DatabaseSchemaScript>) Method

RunDatabaseScripts (String schemaName, Version currentSchemaVersion, IList<DatabaseSchemaScript> scripts)
Execute all scripts which have a version greater than the current schema version.
Parameters
Name Type
schemaName String
currentSchemaVersion Version
scripts System.Collections.Generic.IList<Nucleus.Data.Common.DatabaseSchemaScript>

DatabaseObjectExists (String,DatabaseObjectTypes) Method

DatabaseObjectExists (String name, DatabaseObjectTypes type)
Checks whether the specified database object exists.