The concrete type of this TableMigration
(ReversibleTableMigration or IrreversibleTableMigration).* Operations that are in of themselves reversible will return an instance of this type.
[use case] Append a ReversibleMigration to form either a
ReversibleMigrationSeq if the left side of &
is also a ReversibleMigration;
or else a plain MigrationSeq
Append a ReversibleMigration to form either a
ReversibleMigrationSeq if the left side of &
is also a ReversibleMigration;
or else a plain MigrationSeq
the ReversibleMigration to append
val combined = mig1 & mig2 & mig3
[use case] Append another Migration to form a MigrationSeq
Append another Migration to form a MigrationSeq
the Migration to append
val combined = mig1 & mig2 & mig3
The SQL statements to run
The SQL statements to run
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.)
zero or more column-returning functions, which are passed the table object.
tblMig.addColumns(_.col1, _.col2, _.column[Int]("fieldNotYetInTableDef"))
Adds foreign key constraints.
Adds foreign key constraints.
zero or more ForeignKeyQuery
-returning functions, which are passed the table object.
tblMig.addForeignKeys(_.fkDef)
Adds indexes
Adds indexes
zero or more Index
-returning functions, which are passed the table object.
tblMig.addIndexes(_.idxDef)
Adds primary key constraints.
Adds primary key constraints.
zero or more PrimaryKey
-returning functions, which are passed the table object.
tblMig.addPrimaryKeys(_.pkDef)
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
zero or more column-returning functions, which are passed the table object.
tblMig.alterColumnDefaults(_.col1, _.column[Int]("col2", O.Default("notTheDefaultInTableDef")))
Changes the nullability of columns based on the column definitions in cols
Changes the nullability of columns based on the column definitions in cols
zero or more column-returning functions, which are passed the table object.
tblMig.alterColumnNulls(_.col1, _.column[Int]("col2", O.NotNull))
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
zero or more column-returning functions, which are passed the table object.
tblMig.alterColumnTypes(_.col1, _.column[NotTheTypeInTableDef]("col2"))
a Slick driver, used to extract ColumnInfo#sqlType
and ColumnInfo#notNull
by calling typeInfoFor
a ColumnInfo
representing the relevant information in column
Create the table.
Create the table. Note: drop + create is allowed.
Drop the table.
Drop the table. Note: drop + create is allowed.
Drop columns.
Drop columns.
zero or more column-returning functions, which are passed the table object.
tblMig.dropColumns(_.col1, _.col2, _.column[Int]("oldFieldNotInTableDef"))
Drops foreign key constraints.
Drops foreign key constraints.
zero or more ForeignKeyQuery
-returning functions, which are passed the table object.
tblMig.dropForeignKeys(_.fkDef)
Drops indexes
Drops indexes
zero or more Index
-returning functions, which are passed the table object.
tblMig.dropIndexes(_.idxDef)
Drops primary key constraints.
Drops primary key constraints.
zero or more PrimaryKey
-returning functions, which are passed the table object.
tblMig.dropPrimaryKeys(_.pkDef)
a FieldSymbol
representing the column
if node
represents a reference to a table's column, that is, it is a Select(_, f: FieldSymbol)
,
then Some(f)
; otherwise None
an IndexInfo
containing the relevant information from a Slick Index
Rename the table
Rename the table
the new name for the table
Rename a column.
Rename a column.
a column-returning function, which is passed the table object.
tblMig.renameColumns(_.col1, "newName")
Renames an index
Renames an index
an Index
-returning function, which is passed the table object.
tblMig.renameIndex(_.idxDef, "newName")
Runs all the SQL statements in a single transaction
Runs all the SQL statements in a single transaction
a Slick table object whose qualified name is needed
a TableInfo
representing the qualified name of table
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 originalTableMigration
. 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 implicitSession
). Being an SqlMigration you can also call thesql
method to see the SQL statement(s) it uses.This class is abstract; use its companion object as a factory to get an instance.