0

Is it possible to create multiple databases using a single query using slick?

 sqlu"""CREATE DATABASE if not exists students;CREATE DATABASE if NOT professors"""

I'm running the above slick query but getting MySQLSyntaxErrorException

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE DATABASE if NOT EXISTS professors' at line 1

Sheshank Kodam
  • 515
  • 5
  • 17

1 Answers1

0

Ive found answer to my own question

val createDbs = DBIO.seq(sqlu"""CREATE DATABASE if not exists students""",
  sqlu"""CREATE DATABASE if not exists professors """)
db.run(createDbs)
Sheshank Kodam
  • 515
  • 5
  • 17