TableMigration

slick.migration.api.TableMigration
See theTableMigration companion object
case class TableMigration[T <: Table[_], A <: Action](tableInfo: TableInfo, actions: List[A])(table: T)(implicit dialect: Dialect[_], withActions: WithActions[A]) extends SqlMigration

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait SqlMigration
trait Migration
class Object
trait Matchable
class Any
Show all

Members list

Grouped members

oper

def addColumns(cols: T => Rep[_]*): TableMigration[T, A]

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

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

Value parameters

cols

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

Attributes

Example
 tblMig.addColumns(_.col1, _.col2, _.column[Int]("fieldNotYetInTableDef")) 
def addForeignKeys(fkqs: T => ForeignKeyQuery[_ <: AbstractTable[_], _]*): TableMigration[T, A]

Adds foreign key constraints.

Adds foreign key constraints.

Value parameters

fkqs

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

Attributes

Example
 tblMig.addForeignKeys(_.fkDef) 
def addIndexes(indexes: T => Index*): TableMigration[T, A]

Adds indexes

Adds indexes

Value parameters

indexes

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

Attributes

Example
 tblMig.addIndexes(_.idxDef) 
def addPrimaryKeys(pks: T => PrimaryKey*): TableMigration[T, A]

Adds primary key constraints.

Adds primary key constraints.

Value parameters

pks

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

Attributes

Example
 tblMig.addPrimaryKeys(_.pkDef) 
def alterColumnDefaults(cols: T => Rep[_]*): TableMigration[T, Action]

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

Value parameters

cols

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

Attributes

Example
 tblMig.alterColumnDefaults(_.col1, _.column[Int]("col2", O.Default("notTheDefaultInTableDef"))) 
def alterColumnNulls(cols: T => Rep[_]*): TableMigration[T, Action]

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

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

Value parameters

cols

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

Attributes

Example
 tblMig.alterColumnNulls(_.col1, _.column[Int]("col2", O.NotNull)) 
def alterColumnTypes(cols: T => Rep[_]*): TableMigration[T, Action]

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

Value parameters

cols

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

Attributes

Example
 tblMig.alterColumnTypes(_.col1, _.column[NotTheTypeInTableDef]("col2")) 
def create: TableMigration[T, A]

Create the table.

Create the table.

Attributes

Drop the table.

Drop the table.

Attributes

def dropColumns(cols: T => Rep[_]*): TableMigration[T, A]

Drop columns.

Drop columns.

Value parameters

cols

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

Attributes

Example
 tblMig.dropColumns(_.col1, _.col2, _.column[Int]("oldFieldNotInTableDef")) 
def dropForeignKeys(fkqs: T => ForeignKeyQuery[_ <: AbstractTable[_], _]*): TableMigration[T, A]

Drops foreign key constraints.

Drops foreign key constraints.

Value parameters

fkqs

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

Attributes

Example
 tblMig.dropForeignKeys(_.fkDef) 
def dropIndexes(indexes: T => Index*): TableMigration[T, A]

Drops indexes

Drops indexes

Value parameters

indexes

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

Attributes

Example
 tblMig.dropIndexes(_.idxDef) 
def dropPrimaryKeys(pks: T => PrimaryKey*): TableMigration[T, A]

Drops primary key constraints.

Drops primary key constraints.

Value parameters

pks

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

Attributes

Example
 tblMig.dropPrimaryKeys(_.pkDef) 
def rename(to: String): TableMigration[T, A]

Rename the table

Rename the table

Value parameters

to

the new name for the table

Attributes

def renameColumn(col: T => Rep[_], to: String): TableMigration[T, A]

Rename a column.

Rename a column.

Value parameters

col

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

Attributes

Example
 tblMig.renameColumn(_.col1, "newName") 
def renameIndex(index: T => Index, to: String): TableMigration[T, A]

Renames an index

Renames an index

Value parameters

index

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

Attributes

Example
 tblMig.renameIndex(_.idxDef, "newName") 

Value members

Concrete methods

def addColumnAndSet[C](col: T => Rep[C], value: C)(implicit jdbcType: JdbcType[C]): TableMigration[T, A]

Adds a column and populates it without a column default in the future.

Adds a column and populates it without a column default in the future.

Attributes

def addColumnAndSetRaw(col: T => Rep[_], rawSqlExpr: String): TableMigration[T, A]

Attributes

Note

rawSqlExpr is used as raw SQL, with the security implications thereof

def dropColumns(name: String, names: String*): TableMigration[T, Action]
def renameColumnFrom(from: String, col: T => Rep[_]): TableMigration[T, A]
def renameFrom(from: String): TableMigration[T, A]
def renameIndexFrom(from: String, index: T => Index): TableMigration[T, A]
def sql: Seq[String]

The SQL statements to run

The SQL statements to run

Attributes

Inherited methods

def apply(): DBIO[Unit]
Implicitly added by Reversible

Attributes

Inherited from:
SqlMigration
def apply(): DBIO[Unit]

Attributes

Inherited from:
SqlMigration
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Concrete fields

val table: T
Implicitly added by Reversible