2
votes

In PlaySlick sample there is file with sample data access object.

https://github.com/playframework/play-slick/blob/master/samples/basic/app/dao/CatDAO.scala

and table definition:

  private class CatsTable(tag: Tag) extends Table[Cat](tag, "CAT") {

    def name = column[String]("NAME", O.PrimaryKey)
    def color = column[String]("COLOR")

    def * = (name, color) <> (Cat.tupled, Cat.unapply)
  }

Is it possible to generate a new table using this definition without using play evolutions? If not, why?

1

1 Answers

2
votes

Unfortunatelly, it is not possible using only slick table definitions. From slick documentation:

Slick itself does not have out-of-the-box support for database migrations, but there are some third-party tools that work well with Slick.

But they point out some alternatives here.

From some person that work at the slick team:

Both Slick and the Slick DDL Plugin can only generate code to create or delete your schema, not to evolve it. So you still need Play evolutions or something similar to modify an existing schema along the way.

Checkout the answer here.