Play framework Slick 3 how to disable H2 foreign key constraints by scala? -


i'm using play framework 2.3 scala. database management i'm using slick 3. temporally disable foreign key constraints h2 database. found possible in h2 set referential_integrity false. don't know how set scala in slick. please let me know?

you can use plain sqlu"set referential_integrity false". please see http://slick.typesafe.com/doc/3.0.0/sql.html

edit: working code,

import slick.driver.h2driver.api._ import scala.concurrent.executioncontext.implicits.global  object test extends app {    def db = database.forurl(         url    = s"jdbc:h2:mem:test",         driver = "org.h2.driver"   )    def disablerefint = {       val result = db.run(sqlu"set foreign_key_checks = 0 ");       result onsuccess {           case x => println("done command" + x.tostring());       }       result onfailure {           case x => println("not done command" + x.tostring());       }   }  } 

for reason "set referential_integrity false" giving error while, "set foreign_key_checks=0" seems working fine.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -