Jatin
Jatin

Reputation: 31734

create a database on startup

I am using play 2.1.1.

What I want is, when play starts it should also create a database.

So as said in documentation, in my evolution 1.sql I added the line Create Database videos. But instead I get the below error. (Which is obvious, as it is trying to connect to database which does not exist).

enter image description here

What should I do, so that play on start up, creates a database and then uses it? Currently it first tries to connect to a database and then call my evolution files.

Upvotes: 0

Views: 498

Answers (1)

Gabor Jakab
Gabor Jakab

Reputation: 246

See: where-do-i-put-startup-code-in-play-framework

In there you connect to your mysql with the appropriate user / pw and create a database, you can use DDL for all your tables and predefined data.

Upvotes: 2

Related Questions