View Source
  Class MigrationBase
  
  Provides a base class to all migrations.
 
  
  
    Inheritance
      System.Object
      
   
  
  Assembly: Umbraco.Infrastructure.dll
  Syntax
  
    public abstract class MigrationBase : IDiscoverable
   
  Constructors
  
  
    View Source
  
  MigrationBase(IMigrationContext)
  
  
  Declaration
  
    protected MigrationBase(IMigrationContext context)
   
  Parameters
  
  Properties
  
  
    View Source
  
  Alter
  Builds an Alter expression.
 
  
  Declaration
  
    public IAlterBuilder Alter { get; }
   
  Property Value
  
  
    View Source
  
  Context
  Gets the migration context.
 
  
  Declaration
  
    protected IMigrationContext Context { get; }
   
  Property Value
  
  
    View Source
  
  Create
  Builds a Create expression.
 
  
  Declaration
  
    public ICreateBuilder Create { get; }
   
  Property Value
  
  
    View Source
  
  Database
  Gets the database instance.
 
  
  Declaration
  
    protected IUmbracoDatabase Database { get; }
   
  Property Value
  
  
    View Source
  
  DatabaseType
  
  
  Declaration
  
    protected DatabaseType DatabaseType { get; }
   
  Property Value
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | DatabaseType | 
         | 
      
    
  
  
    View Source
  
  Delete
  Builds a Delete expression.
 
  
  Declaration
  
    public IDeleteBuilder Delete { get; }
   
  Property Value
  
  
    View Source
  
  Execute
  Builds an Execute expression.
 
  
  Declaration
  
    public IExecuteBuilder Execute { get; }
   
  Property Value
  
  
    View Source
  
  Insert
  Builds an Insert expression.
 
  
  Declaration
  
    public IInsertBuilder Insert { get; }
   
  Property Value
  
  
    View Source
  
  Logger
  
  
  Declaration
  
    protected ILogger Logger { get; }
   
  Property Value
  
  
    View Source
  
  RebuildCache
  If this is set to true, the published cache will be rebuild upon successful completion of the migration.
 
  
  Declaration
  
    public bool RebuildCache { get; set; }
   
  Property Value
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    View Source
  
  Rename
  Builds a Rename expression.
 
  
  Declaration
  
    public IRenameBuilder Rename { get; }
   
  Property Value
  
  
    View Source
  
  SqlSyntax
  
  
  Declaration
  
    protected ISqlSyntaxProvider SqlSyntax { get; }
   
  Property Value
  
  
    View Source
  
  Update
  Builds an Update expression.
 
  
  Declaration
  
    public IUpdateBuilder Update { get; }
   
  Property Value
  
  Methods
  
  
    View Source
  
  AddColumn<T>(String)
  
  
  Declaration
  
    protected void AddColumn<T>(string columnName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        columnName | 
         | 
      
    
  
  Type Parameters
  
  
    View Source
  
  AddColumn<T>(String, out IEnumerable<String>)
  
  
  Declaration
  
    protected void AddColumn<T>(string columnName, out IEnumerable<string> sqls)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        columnName | 
         | 
      
      
        | System.Collections.Generic.IEnumerable<System.String> | 
        sqls | 
         | 
      
    
  
  Type Parameters
  
  
    View Source
  
  AddColumn<T>(String, String)
  
  
  Declaration
  
    protected void AddColumn<T>(string tableName, string columnName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        tableName | 
         | 
      
      
        | System.String | 
        columnName | 
         | 
      
    
  
  Type Parameters
  
  
    View Source
  
  AddColumn<T>(String, String, out IEnumerable<String>)
  
  
  Declaration
  
    protected void AddColumn<T>(string tableName, string columnName, out IEnumerable<string> sqls)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        tableName | 
         | 
      
      
        | System.String | 
        columnName | 
         | 
      
      
        | System.Collections.Generic.IEnumerable<System.String> | 
        sqls | 
         | 
      
    
  
  Type Parameters
  
  
    View Source
  
  AddColumnIfNotExists<T>(IEnumerable<ColumnInfo>, String)
  
  
  Declaration
  
    protected void AddColumnIfNotExists<T>(IEnumerable<ColumnInfo> columns, string columnName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IEnumerable<ColumnInfo> | 
        columns | 
         | 
      
      
        | System.String | 
        columnName | 
         | 
      
    
  
  Type Parameters
  
  
    View Source
  
  AddColumnIfNotExists<T>(IEnumerable<ColumnInfo>, String, String)
  
  
  Declaration
  
    protected void AddColumnIfNotExists<T>(IEnumerable<ColumnInfo> columns, string tableName, string columnName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.Collections.Generic.IEnumerable<ColumnInfo> | 
        columns | 
         | 
      
      
        | System.String | 
        tableName | 
         | 
      
      
        | System.String | 
        columnName | 
         | 
      
    
  
  Type Parameters
  
  
    View Source
  
  AlterColumn<T>(String, String)
  
  
  Declaration
  
    protected void AlterColumn<T>(string tableName, string columnName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        tableName | 
         | 
      
      
        | System.String | 
        columnName | 
         | 
      
    
  
  Type Parameters
  
  
    View Source
  
  ColumnExists(String, String)
  
  
  Declaration
  
    protected bool ColumnExists(string tableName, string columnName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        tableName | 
         | 
      
      
        | System.String | 
        columnName | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    View Source
  
  ColumnType(String, String)
  
  
  Declaration
  
    protected string ColumnType(string tableName, string columnName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        tableName | 
         | 
      
      
        | System.String | 
        columnName | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.String | 
         | 
      
    
  
  
    View Source
  
  CreateIndex<T>(String)
  
  
  Declaration
  
    protected void CreateIndex<T>(string toCreate)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        toCreate | 
         | 
      
    
  
  Type Parameters
  
  
    View Source
  
  DeleteIndex<T>(String)
  
  
  Declaration
  
    protected void DeleteIndex<T>(string toDelete)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        toDelete | 
         | 
      
    
  
  Type Parameters
  
  
    View Source
  
  IndexExists(String)
  
  
  Declaration
  
    protected bool IndexExists(string indexName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        indexName | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    View Source
  
  Migrate()
  
  
  Declaration
  
    protected abstract void Migrate()
   
  
    View Source
  
  PrimaryKeyExists(String, String)
  
  
  Declaration
  
    protected bool PrimaryKeyExists(string tableName, string primaryKeyName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        tableName | 
         | 
      
      
        | System.String | 
        primaryKeyName | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         | 
      
    
  
  
    View Source
  
  ReplaceColumn<T>(String, String, String)
  
  
  Declaration
  
    protected void ReplaceColumn<T>(string tableName, string currentName, string newName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        tableName | 
         | 
      
      
        | System.String | 
        currentName | 
         | 
      
      
        | System.String | 
        newName | 
         | 
      
    
  
  Type Parameters
  
  
    View Source
  
  Run()
  
  
  Declaration
  
  
    View Source
  
  Sql()
  Creates a new Sql statement.
 
  
  Declaration
  
    protected Sql<ISqlContext> Sql()
   
  Returns
  
  
    View Source
  
  Sql(String, Object[])
  Creates a new Sql statement with arguments.
 
  
  Declaration
  
    protected Sql<ISqlContext> Sql(string sql, params object[] args)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        sql | 
         | 
      
      
        | System.Object[] | 
        args | 
         | 
      
    
  
  Returns
  
  
    View Source
  
  TableExists(String)
  
  
  Declaration
  
    protected bool TableExists(string tableName)
   
  Parameters
  
    
      
        | Type | 
        Name | 
        Description | 
      
    
    
      
        | System.String | 
        tableName | 
         | 
      
    
  
  Returns
  
    
      
        | Type | 
        Description | 
      
    
    
      
        | System.Boolean | 
         |