Class/Object

slick.migration.api

TableMigration

Related Docs: object TableMigration | package api

Permalink

sealed abstract class TableMigration[T <: driver.JdbcDriver.Table[_]] extends SqlMigration with AstHelpers with Equals

The base class for table migrations. A table migration is a Migration that performs changes to a table.

See this class's methods for a list of available operations. Calling an operation method returns a new TableMigration that has that operation added, over operations contained in the original TableMigration. This allows for a nice method chaining syntax.

Like all Migrations, you can run the resulting TableMigration by calling its apply method (it expects an implicit Session). Being an SqlMigration you can also call the sql method to see the SQL statement(s) it uses.

This class is abstract; use its companion object as a factory to get an instance.

Self Type
TableMigration[T]
Example:
  1. object table1 extends Table[(Int, Int, Int)]("table1") {
      def col1 = column[Int]("col1")
      def col2 = column[Int]("col2")
      def col3 = column[Int]("col3")
      def * = col1 ~ col2 ~ col3
    }
    implicit val dialect = new H2Dialect
    val migration = TableMigration(table1)
                      .addColumns(_.col1, _.col2)
                      .addColumns(_.col3)
Linear Supertypes
Equals, AstHelpers, SqlMigration, Migration, AnyRef, Any
Known Subclasses
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. TableMigration
  2. Equals
  3. AstHelpers
  4. SqlMigration
  5. Migration
  6. AnyRef
  7. Any
Implicitly
  1. by MigrationConcat
  2. by any2stringadd
  3. by StringFormat
  4. by Ensuring
  5. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract type Self <: TableMigration[T]

    Permalink

    The concrete type of this TableMigration (ReversibleTableMigration or IrreversibleTableMigration).* Operations that are in of themselves reversible will return an instance of this type.

Abstract Value Members

  1. abstract def data: TableMigrationData

    Permalink
    Attributes
    protected[slick.migration.api]
  2. abstract def withData(data: TableMigrationData): Self

    Permalink
    Attributes
    protected

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def &(n: ReversibleMigration): ReversibleMigrationSeq

    Permalink

    [use case] Append a ReversibleMigration to form either a ReversibleMigrationSeq if the left side of & is also a ReversibleMigration; or else a plain MigrationSeq

    [use case]

    Append a ReversibleMigration to form either a ReversibleMigrationSeq if the left side of & is also a ReversibleMigration; or else a plain MigrationSeq

    n

    the ReversibleMigration to append

    Implicit information
    This member is added by an implicit conversion from TableMigration[T] to MigrationConcat[TableMigration[T]] performed by method MigrationConcat in slick.migration.api.Migration.
    Definition Classes
    MigrationConcat
    Full Signature

    def &[N <: Migration, O](n: N)(implicit ccm: CanConcatMigrations[TableMigration[T], N, O]): O

    Example:
    1. val combined = mig1 & mig2 & mig3
  4. def &(n: Migration): MigrationSeq

    Permalink

    [use case] Append another Migration to form a MigrationSeq

    [use case]

    Append another Migration to form a MigrationSeq

    n

    the Migration to append

    Implicit information
    This member is added by an implicit conversion from TableMigration[T] to MigrationConcat[TableMigration[T]] performed by method MigrationConcat in slick.migration.api.Migration.
    Definition Classes
    MigrationConcat
    Full Signature

    def &[N <: Migration, O](n: N)(implicit ccm: CanConcatMigrations[TableMigration[T], N, O]): O

    Example:
    1. val combined = mig1 & mig2 & mig3
  5. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from TableMigration[T] to any2stringadd[TableMigration[T]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  6. def ->[B](y: B): (TableMigration[T], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from TableMigration[T] to ArrowAssoc[TableMigration[T]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  7. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def actions: Seq[DBIO[_]]

    Permalink

    The SQL statements to run

    The SQL statements to run

    Definition Classes
    TableMigrationSqlMigration
  9. def addColumns(cols: (T) ⇒ Rep[_]*): Self

    Permalink

    Add columns to the table.

    Add columns to the table. (If the table is being created, these may be incorporated into the CREATE TABLE statement.)

    cols

    zero or more column-returning functions, which are passed the table object.

    Example:
    1. tblMig.addColumns(_.col1, _.col2, _.column[Int]("fieldNotYetInTableDef"))
  10. def addForeignKeys(fkqs: (T) ⇒ ForeignKeyQuery[_ <: AbstractTable[_], _]*): Self

    Permalink

    Adds foreign key constraints.

    Adds foreign key constraints.

    fkqs

    zero or more ForeignKeyQuery-returning functions, which are passed the table object.

    Example:
    1. tblMig.addForeignKeys(_.fkDef)
  11. def addIndexes(indexes: (T) ⇒ Index*): Self

    Permalink

    Adds indexes

    Adds indexes

    indexes

    zero or more Index-returning functions, which are passed the table object.

    Example:
    1. tblMig.addIndexes(_.idxDef)
  12. def addPrimaryKeys(pks: (T) ⇒ PrimaryKey*): Self

    Permalink

    Adds primary key constraints.

    Adds primary key constraints.

    pks

    zero or more PrimaryKey-returning functions, which are passed the table object.

    Example:
    1. tblMig.addPrimaryKeys(_.pkDef)
  13. def alterColumnDefaults(cols: (T) ⇒ Rep[_]*): IrreversibleTableMigration[T]

    Permalink

    Changes the default value of columns based on the column definitions in cols

    Changes the default value of columns based on the column definitions in cols

    cols

    zero or more column-returning functions, which are passed the table object.

    Example:
    1. tblMig.alterColumnDefaults(_.col1, _.column[Int]("col2", O.Default("notTheDefaultInTableDef")))
  14. def alterColumnNulls(cols: (T) ⇒ Rep[_]*): IrreversibleTableMigration[T]

    Permalink

    Changes the nullability of columns based on the column definitions in cols

    Changes the nullability of columns based on the column definitions in cols

    cols

    zero or more column-returning functions, which are passed the table object.

    Example:
    1. tblMig.alterColumnNulls(_.col1, _.column[Int]("col2", O.NotNull))
  15. def alterColumnTypes(cols: (T) ⇒ Rep[_]*): IrreversibleTableMigration[T]

    Permalink

    Changes the data type of columns based on the column definitions in cols

    Changes the data type of columns based on the column definitions in cols

    cols

    zero or more column-returning functions, which are passed the table object.

    Example:
    1. tblMig.alterColumnTypes(_.col1, _.column[NotTheTypeInTableDef]("col2"))
  16. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  17. def canEqual(that: Any): Boolean

    Permalink
    Definition Classes
    TableMigration → Equals
  18. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. def columnInfo(driver: JdbcDriver, column: FieldSymbol): ColumnInfo

    Permalink

    driver

    a Slick driver, used to extract ColumnInfo#sqlType and ColumnInfo#notNull by calling typeInfoFor

    returns

    a ColumnInfo representing the relevant information in column

    Attributes
    protected
    Definition Classes
    AstHelpers
  20. def create: Self

    Permalink

    Create the table.

    Create the table. Note: drop + create is allowed.

  21. def drop: IrreversibleTableMigration[T]

    Permalink

    Drop the table.

    Drop the table. Note: drop + create is allowed.

  22. def dropColumns(cols: (T) ⇒ Rep[_]*): Self

    Permalink

    Drop columns.

    Drop columns.

    cols

    zero or more column-returning functions, which are passed the table object.

    Example:
    1. tblMig.dropColumns(_.col1, _.col2, _.column[Int]("oldFieldNotInTableDef"))
  23. def dropForeignKeys(fkqs: (T) ⇒ ForeignKeyQuery[_ <: AbstractTable[_], _]*): Self

    Permalink

    Drops foreign key constraints.

    Drops foreign key constraints.

    fkqs

    zero or more ForeignKeyQuery-returning functions, which are passed the table object.

    Example:
    1. tblMig.dropForeignKeys(_.fkDef)
  24. def dropIndexes(indexes: (T) ⇒ Index*): Self

    Permalink

    Drops indexes

    Drops indexes

    indexes

    zero or more Index-returning functions, which are passed the table object.

    Example:
    1. tblMig.dropIndexes(_.idxDef)
  25. def dropPrimaryKeys(pks: (T) ⇒ PrimaryKey*): Self

    Permalink

    Drops primary key constraints.

    Drops primary key constraints.

    pks

    zero or more PrimaryKey-returning functions, which are passed the table object.

    Example:
    1. tblMig.dropPrimaryKeys(_.pkDef)
  26. def ensuring(cond: (TableMigration[T]) ⇒ Boolean, msg: ⇒ Any): TableMigration[T]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TableMigration[T] to Ensuring[TableMigration[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  27. def ensuring(cond: (TableMigration[T]) ⇒ Boolean): TableMigration[T]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TableMigration[T] to Ensuring[TableMigration[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  28. def ensuring(cond: Boolean, msg: ⇒ Any): TableMigration[T]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TableMigration[T] to Ensuring[TableMigration[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  29. def ensuring(cond: Boolean): TableMigration[T]

    Permalink
    Implicit information
    This member is added by an implicit conversion from TableMigration[T] to Ensuring[TableMigration[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  30. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  31. def equals(a: Any): Boolean

    Permalink
    Definition Classes
    TableMigration → Equals → AnyRef → Any
  32. def fieldSym(column: Rep[_]): FieldSymbol

    Permalink

    returns

    a FieldSymbol representing the column

    Attributes
    protected
    Definition Classes
    AstHelpers
  33. def fieldSym(node: Node): Option[FieldSymbol]

    Permalink

    returns

    if node represents a reference to a table's column, that is, it is a Select(_, f: FieldSymbol), then Some(f); otherwise None

    Attributes
    protected
    Definition Classes
    AstHelpers
  34. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  35. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from TableMigration[T] to StringFormat[TableMigration[T]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  36. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  37. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  38. def indexInfo(index: Index): IndexInfo

    Permalink

    returns

    an IndexInfo containing the relevant information from a Slick Index

    Attributes
    protected
    Definition Classes
    AstHelpers
  39. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  40. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  41. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  42. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  43. def rename(to: String): Self

    Permalink

    Rename the table

    Rename the table

    to

    the new name for the table

  44. def renameColumn(col: (T) ⇒ Rep[_], to: String): Self

    Permalink

    Rename a column.

    Rename a column.

    col

    a column-returning function, which is passed the table object.

    Example:
    1. tblMig.renameColumns(_.col1, "newName")
  45. def renameIndex(index: (T) ⇒ Index, to: String): Self

    Permalink

    Renames an index

    Renames an index

    index

    an Index-returning function, which is passed the table object.

    Example:
    1. tblMig.renameIndex(_.idxDef, "newName")
  46. def run(db: DatabaseDef)(implicit ec: ExecutionContext): Future[Unit]

    Permalink

    Runs all the SQL statements in a single transaction

    Runs all the SQL statements in a single transaction

    Definition Classes
    SqlMigrationMigration
  47. def seq: DBIO[Unit]

    Permalink
    Definition Classes
    SqlMigration
  48. def statements: Seq[String]

    Permalink
    Definition Classes
    SqlMigrationMigration
  49. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  50. def tableInfo: TableInfo

    Permalink
  51. def tableInfo(table: TableNode): TableInfo

    Permalink

    table

    a Slick table object whose qualified name is needed

    returns

    a TableInfo representing the qualified name of table

    Attributes
    protected
    Definition Classes
    AstHelpers
  52. def toString(): String

    Permalink
    Definition Classes
    TableMigration → AnyRef → Any
  53. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. def [B](y: B): (TableMigration[T], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from TableMigration[T] to ArrowAssoc[TableMigration[T]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from Equals

Inherited from AstHelpers

Inherited from SqlMigration

Inherited from Migration

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion MigrationConcat from TableMigration[T] to MigrationConcat[TableMigration[T]]

Inherited by implicit conversion any2stringadd from TableMigration[T] to any2stringadd[TableMigration[T]]

Inherited by implicit conversion StringFormat from TableMigration[T] to StringFormat[TableMigration[T]]

Inherited by implicit conversion Ensuring from TableMigration[T] to Ensuring[TableMigration[T]]

Inherited by implicit conversion ArrowAssoc from TableMigration[T] to ArrowAssoc[TableMigration[T]]

Schema Manipulation Operations

Ungrouped