Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Improved tests for scalikejdbc-play-plugin #114

Merged
merged 2 commits into from

3 participants

Toshiyuki Takahashi BuildHive Kazuhiro Sera
Toshiyuki Takahashi
Collaborator
  • scalikejdbc-play-fixture-plugin loads fixture, but doesn't execute DDLs.
  • Use play-flyway plugin for migration.
tototoshi added some commits
Toshiyuki Takahashi tototoshi Improved tests for scalikejdbc-play-plugin
 - scalikejdbc-play-fixture-plugin loads fixture, but doesn't execute DDLs.
 - Use play-flyway plugin for migration.
ae8921f
Toshiyuki Takahashi tototoshi Updated README 77cd84d
Kazuhiro Sera seratch was assigned
BuildHive

Kazuhiro Sera » scalikejdbc #2 FAILURE
Looks like there's a problem with this pull request
(what's this?)

Kazuhiro Sera seratch merged commit 8805b20 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 3, 2013
  1. Toshiyuki Takahashi

    Improved tests for scalikejdbc-play-plugin

    tototoshi authored
     - scalikejdbc-play-fixture-plugin loads fixture, but doesn't execute DDLs.
     - Use play-flyway plugin for migration.
  2. Toshiyuki Takahashi

    Updated README

    tototoshi authored
This page is out of date. Refresh to see the latest.
5 project/Build.scala
View
@@ -274,8 +274,9 @@ object ScalikeJDBCProjects extends Build {
val appVersion = "1.0"
val appDependencies = Seq(
- "com.h2database" % "h2" % "[1.3,)",
- "postgresql" % "postgresql" % "9.1-901.jdbc4"
+ "com.github.tototoshi" %% "play-flyway" % "0.1.1",
+ "com.h2database" % "h2" % "[1.3,)",
+ "postgresql" % "postgresql" % "9.1-901.jdbc4"
)
play.Project(appName, appVersion, appDependencies,
55 scalikejdbc-play-fixture-plugin/readme.md
View
@@ -22,7 +22,7 @@ This plugin uses the default Database configuration.
```
# Database configuration
-# ~~~~~
+# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
db.default.driver=org.h2.Driver
@@ -49,30 +49,53 @@ PlayFixturePlugin should be loaded after PlayPlugin.
```sql
# --- !Ups
-create table project (
-id bigint not null primary key,
-name varchar(255) not null,
-folder varchar(255) not null
-);
-create sequence project_seq start with 1000;
+
+INSERT INTO project (id, name, folder) VALUES (1, 'Play 2.0', 'Play framework');
+INSERT INTO project (id, name, folder) VALUES (2, 'Play 1.2.4', 'Play framework');
+INSERT INTO project (id, name, folder) VALUES (3, 'Website', 'Play framework');
+INSERT INTO project (id, name, folder) VALUES (4, 'Secret project', 'Zenexity');
+INSERT INTO project (id, name, folder) VALUES (5, 'Playmate', 'Zenexity');
+INSERT INTO project (id, name, folder) VALUES (6, 'Things to do', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (7, 'Play samples', 'Zenexity');
+INSERT INTO project (id, name, folder) VALUES (8, 'Private', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (9, 'Private', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (10, 'Private', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (11, 'Private', 'Personal');
+ALTER SEQUENCE project_seq RESTART WITH 12;
# --- !Downs
-drop sequence project_seq;
-drop table project;
+ALTER SEQUENCE project_seq RESTART WITH 1;
+DELETE FROM project;
```
### conf/db/fixtures/defaut/project_member.sql
```sql
# --- !Ups
-create table project_member (
-project_id bigint not null,
-user_email varchar(255) not null,
-foreign key(project_id) references project(id) on delete cascade,
-foreign key(user_email) references users(email) on delete cascade
-);
+
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'sadek@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (2, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (2, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (3, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (3, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'sadek@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (5, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (6, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (7, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (7, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (8, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (9, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (10, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (11, 'sadek@sample.com');
# --- !Downs
-drop table project_member;
+
+DELETE FROM project_member;
```
118 scalikejdbc-play-plugin/test/zentasks/app/Global.scala
View
@@ -1,118 +0,0 @@
-import play.api._
-
-import models._
-
-object Global extends GlobalSettings {
-
- override def onStart(app: Application) {
- InitialData.createTables()
- InitialData.insert()
- }
-
-}
-
-/**
- * Initial set of data to be imported
- * in the sample application.
- */
-object InitialData {
-
- def date(str: String) = new java.text.SimpleDateFormat("yyyy-MM-dd").parse(str)
-
- def createTables() = {
-
- import scalikejdbc._
- val ddl = """
-drop table if exists users;
-create table users (
- email varchar(255) not null primary key,
- name varchar(255) not null,
- password varchar(255) not null
-);
-
-drop table if exists project;
-create table project (
- id bigint not null primary key,
- name varchar(255) not null,
- folder varchar(255) not null
-);
-
-drop sequence if exists project_seq;
-create sequence project_seq start with 1000;
-
-drop table if exists project_member;
-create table project_member (
- project_id bigint not null,
- user_email varchar(255) not null,
- foreign key(project_id) references project(id) on delete cascade,
- foreign key(user_email) references users(email) on delete cascade
-);
-
-drop table if exists task;
-create table task (
- id bigint not null primary key,
- title varchar(255) not null,
- done boolean,
- due_date timestamp,
- assigned_to varchar(255),
- project bigint not null,
- folder varchar(255),
- foreign key(assigned_to) references users(email) on delete set null,
- foreign key(project) references project(id) on delete cascade
-);
-
-drop sequence if exists task_seq;
-create sequence task_seq start with 1000;
-"""
-
- DB autoCommit { implicit session =>
- try {
- SQL("select * from users").map(rs => rs).list.apply()
- } catch { case e: Exception =>
- SQL(ddl).execute.apply()
- }
- }
-
- }
-
- def insert() = {
-
- if(User.findAll.isEmpty) {
-
- Seq(
- User("guillaume@sample.com", "Guillaume Bort", "secret"),
- User("maxime@sample.com", "Maxime Dantec", "secret"),
- User("sadek@sample.com", "Sadek Drobi", "secret"),
- User("erwan@sample.com", "Erwan Loisant", "secret")
- ).foreach(User.create)
-
- val projects = Seq(
- NewProject("Play framework", "Play 2.0") -> Seq("guillaume@sample.com", "maxime@sample.com", "sadek@sample.com", "erwan@sample.com"),
- NewProject("Play framework", "Play 1.2.4") -> Seq("guillaume@sample.com", "erwan@sample.com"),
- NewProject("Play framework", "Website") -> Seq("guillaume@sample.com", "maxime@sample.com"),
- NewProject("Zenexity", "Secret project") -> Seq("guillaume@sample.com", "maxime@sample.com", "sadek@sample.com", "erwan@sample.com"),
- NewProject("Zenexity", "Playmate") -> Seq("maxime@sample.com"),
- NewProject("Personal", "Things to do") -> Seq("guillaume@sample.com"),
- NewProject("Zenexity", "Play samples") -> Seq("guillaume@sample.com", "maxime@sample.com"),
- NewProject("Personal", "Private") -> Seq("maxime@sample.com"),
- NewProject("Personal", "Private") -> Seq("guillaume@sample.com"),
- NewProject("Personal", "Private") -> Seq("erwan@sample.com"),
- NewProject("Personal", "Private") -> Seq("sadek@sample.com")
- ).map {
- case (project,members) => Project.create(project, members)
- }
-
- Seq(
- NewTask("Todo", projects(0).id, "Fix the documentation", false, None, Some("guillaume@sample.com")),
- NewTask("Urgent", projects(0).id, "Prepare the beta release", false, Some(date("2011-11-15")), None),
- NewTask("Todo", projects(8).id, "Buy some milk", false, None, None),
- NewTask("Todo", projects(1).id, "Check 1.2.4-RC2", false, Some(date("2011-11-18")), Some("guillaume@sample.com")),
- NewTask("Todo", projects(6).id, "Finish zentask integration", true, Some(date("2011-11-15")), Some("maxime@sample.com")),
- NewTask( "Todo", projects(3).id, "Release the secret project", false, Some(date("2012-01-01")), Some("sadek@sample.com"))
- ).foreach(Task.create)
-
- }
-
- }
-
-}
9 scalikejdbc-play-plugin/test/zentasks/conf/application.conf
View
@@ -13,11 +13,14 @@ application.secret="E27D^[_<Lpt0vjad]de;3/i;tx3gpRmG4Byof/3nahO/dIo9gbsMWut1w3xg
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
db.default.driver=org.h2.Driver
-db.default.url="jdbc:h2:mem:play"
+db.default.url="jdbc:h2:mem:play;DB_CLOSE_DELAY=-1"
+db.default.user=sa
db.secondary.driver=org.h2.Driver
-db.secondary.url="jdbc:h2:mem:secondary"
+db.secondary.url="jdbc:h2:mem:secondary;DB_CLOSE_DELAY=-1"
+db.default.fixtures.dev=[ "users.sql", "project.sql", "project_member.sql", "task.sql" ]
+db.default.fixtures.test=[ "users.sql", "project.sql", "project_member.sql", "task.sql" ]
db.secondary.fixtures.test=[ "users.sql", "project.sql", "project_member.sql", "task.sql" ]
-#db.default.user=sa
+
#db.default.password=sa
# ScalikeJDBC original configuration
18 scalikejdbc-play-plugin/test/zentasks/conf/db/fixtures/default/project.sql
View
@@ -0,0 +1,18 @@
+# --- !Ups
+
+INSERT INTO project (id, name, folder) VALUES (1, 'Play 2.0', 'Play framework');
+INSERT INTO project (id, name, folder) VALUES (2, 'Play 1.2.4', 'Play framework');
+INSERT INTO project (id, name, folder) VALUES (3, 'Website', 'Play framework');
+INSERT INTO project (id, name, folder) VALUES (4, 'Secret project', 'Zenexity');
+INSERT INTO project (id, name, folder) VALUES (5, 'Playmate', 'Zenexity');
+INSERT INTO project (id, name, folder) VALUES (6, 'Things to do', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (7, 'Play samples', 'Zenexity');
+INSERT INTO project (id, name, folder) VALUES (8, 'Private', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (9, 'Private', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (10, 'Private', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (11, 'Private', 'Personal');
+ALTER SEQUENCE project_seq RESTART WITH 12;
+
+# --- !Downs
+ALTER SEQUENCE project_seq RESTART WITH 1;
+DELETE FROM project;
26 scalikejdbc-play-plugin/test/zentasks/conf/db/fixtures/default/project_member.sql
View
@@ -0,0 +1,26 @@
+# --- !Ups
+
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'sadek@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (2, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (2, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (3, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (3, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'sadek@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (5, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (6, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (7, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (7, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (8, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (9, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (10, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (11, 'sadek@sample.com');
+
+# --- !Downs
+
+DELETE FROM project_member;
14 scalikejdbc-play-plugin/test/zentasks/conf/db/fixtures/default/task.sql
View
@@ -0,0 +1,14 @@
+# --- !Ups
+
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1000, 'Fix the documentation', FALSE, null, 'guillaume@sample.com', 1, 'Todo');
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1001, 'Prepare the beta release', FALSE, '2011-11-15 00:00:00.0', null, 1, 'Urgent');
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1002, 'Buy some milk', FALSE, null, null, 9, 'Todo');
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1003, 'Check 1.2.4-RC2', FALSE, '2011-11-18 00:00:00.0', 'guillaume@sample.com', 2, 'Todo');
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1004, 'Finish zentask integration', TRUE, '2011-11-15 00:00:00.0', 'maxime@sample.com', 7, 'Todo');
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1005, 'Release the secret project', FALSE, '2012-01-01 00:00:00.0', 'sadek@sample.com', 4, 'Todo');
+ALTER SEQUENCE task_seq RESTART WITH 1006;
+
+# --- !Downs
+ALTER SEQUENCE task_seq RESTART WITH 1000;
+DELETE FROM task;
+
9 scalikejdbc-play-plugin/test/zentasks/conf/db/fixtures/default/users.sql
View
@@ -0,0 +1,9 @@
+# --- !Ups
+INSERT INTO users (email, name, password) VALUES ('guillaume@sample.com', 'Guillaume Bort', 'secret');
+INSERT INTO users (email, name, password) VALUES ('maxime@sample.com', 'Maxime Dantec', 'secret');
+INSERT INTO users (email, name, password) VALUES ('sadek@sample.com', 'Sadek Drobi', 'secret');
+INSERT INTO users (email, name, password) VALUES ('erwan@sample.com', 'Erwan Loisant', 'secret');
+
+
+# --- !Downs
+DELETE FROM users;
25 scalikejdbc-play-plugin/test/zentasks/conf/db/fixtures/secondary/project.sql
View
@@ -1,13 +1,18 @@
-
# --- !Ups
-create table project (
-id bigint not null primary key,
-name varchar(255) not null,
-folder varchar(255) not null
-);
-create sequence project_seq start with 1000;
-# --- !Downs
-drop sequence project_seq;
-drop table project;
+INSERT INTO project (id, name, folder) VALUES (1, 'Play 2.0', 'Play framework');
+INSERT INTO project (id, name, folder) VALUES (2, 'Play 1.2.4', 'Play framewor');
+INSERT INTO project (id, name, folder) VALUES (3, 'Website', 'Play framework');
+INSERT INTO project (id, name, folder) VALUES (4, 'Secret project', 'Zenexity');
+INSERT INTO project (id, name, folder) VALUES (5, 'Playmate', 'Zenexity');
+INSERT INTO project (id, name, folder) VALUES (6, 'Things to do', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (7, 'Play samples', 'Zenexity');
+INSERT INTO project (id, name, folder) VALUES (8, 'Private', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (9, 'Private', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (10, 'Private', 'Personal');
+INSERT INTO project (id, name, folder) VALUES (11, 'Private', 'Personal');
+ALTER SEQUENCE project_seq RESTART WITH 12;
+# --- !Downs
+ALTER SEQUENCE project_seq RESTART WITH 1;
+DELETE FROM project;
30 scalikejdbc-play-plugin/test/zentasks/conf/db/fixtures/secondary/project_member.sql
View
@@ -1,12 +1,26 @@
-
# --- !Ups
-create table project_member (
-project_id bigint not null,
-user_email varchar(255) not null,
-foreign key(project_id) references project(id) on delete cascade,
-foreign key(user_email) references users(email) on delete cascade
-);
+
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'sadek@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (1, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (2, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (2, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (3, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (3, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'sadek@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (4, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (5, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (6, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (7, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (7, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (8, 'maxime@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (9, 'guillaume@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (10, 'erwan@sample.com');
+INSERT INTO project_member (project_id, user_email) VALUES (11, 'sadek@sample.com');
# --- !Downs
-drop table project_member;
+DELETE FROM project_member;
24 scalikejdbc-play-plugin/test/zentasks/conf/db/fixtures/secondary/task.sql
View
@@ -1,18 +1,14 @@
# --- !Ups
-create table task (
-id bigint not null primary key,
-title varchar(255) not null,
-done boolean,
-due_date timestamp,
-assigned_to varchar(255),
-project bigint not null,
-folder varchar(255),
-foreign key(assigned_to) references users(email) on delete set null,
-foreign key(project) references project(id) on delete cascade
-);
-create sequence task_seq start with 1000;
+
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1000, 'Fix the documentation', FALSE, null, 'guillaume@sample.com', 1, 'Todo');
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1001, 'Prepare the beta release', FALSE, '2011-11-15 00:00:00.0', null, 1, 'Urgent');
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1002, 'Buy some milk', FALSE, null, null, 9, 'Todo');
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1003, 'Check 1.2.4-RC2', FALSE, '2011-11-18 00:00:00.0', 'guillaume@sample.com', 2, 'Todo');
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1004, 'Finish zentask integration', TRUE, '2011-11-15 00:00:00.0', 'maxime@sample.com', 7, 'Todo');
+INSERT INTO task (id, title, done, due_date, assigned_to, project, folder) VALUES (1005, 'Release the secret project', FALSE, '2012-01-01 00:00:00.0', 'sadek@sample.com', 4, 'Todo');
+ALTER SEQUENCE task_seq RESTART WITH 1006;
# --- !Downs
-drop sequence task_seq;
-drop table task;
+ALTER SEQUENCE task_seq RESTART WITH 1000;
+DELETE FROM task;
13 scalikejdbc-play-plugin/test/zentasks/conf/db/fixtures/secondary/users.sql 100644 → 100755
View
@@ -1,10 +1,9 @@
# --- !Ups
-create table users (
-email varchar(255) not null primary key,
-name varchar(255) not null,
-password varchar(255) not null
-);
+INSERT INTO users (email, name, password) VALUES ('guillaume@sample.com', 'Guillaume Bort', 'secret');
+INSERT INTO users (email, name, password) VALUES ('maxime@sample.com', 'Maxime Dantec', 'secret');
+INSERT INTO users (email, name, password) VALUES ('sadek@sample.com', 'Sadek Drobi', 'secret');
+INSERT INTO users (email, name, password) VALUES ('erwan@sample.com', 'Erwan Loisant', 'secret');
-# --- !Downs
-drop table users;
+# --- !Downs
+DELETE FROM users;
40 scalikejdbc-play-plugin/test/zentasks/conf/db/migration/default/V1__create_tables.sql
View
@@ -0,0 +1,40 @@
+drop table if exists users;
+create table users (
+ email varchar(255) not null primary key,
+ name varchar(255) not null,
+ password varchar(255) not null
+);
+
+drop table if exists project;
+create table project (
+ id bigint not null primary key,
+ name varchar(255) not null,
+ folder varchar(255) not null
+);
+
+drop sequence if exists project_seq;
+create sequence project_seq start with 1000;
+
+drop table if exists project_member;
+create table project_member (
+ project_id bigint not null,
+ user_email varchar(255) not null,
+ foreign key(project_id) references project(id) on delete cascade,
+ foreign key(user_email) references users(email) on delete cascade
+);
+
+drop table if exists task;
+create table task (
+ id bigint not null primary key,
+ title varchar(255) not null,
+ done boolean,
+ due_date timestamp,
+ assigned_to varchar(255),
+ project bigint not null,
+ folder varchar(255),
+ foreign key(assigned_to) references users(email) on delete set null,
+ foreign key(project) references project(id) on delete cascade
+);
+
+drop sequence if exists task_seq;
+create sequence task_seq start with 1000;
40 scalikejdbc-play-plugin/test/zentasks/conf/db/migration/secondary/V1__create_tables.sql
View
@@ -0,0 +1,40 @@
+drop table if exists users;
+create table users (
+ email varchar(255) not null primary key,
+ name varchar(255) not null,
+ password varchar(255) not null
+);
+
+drop table if exists project;
+create table project (
+ id bigint not null primary key,
+ name varchar(255) not null,
+ folder varchar(255) not null
+);
+
+drop sequence if exists project_seq;
+create sequence project_seq start with 1000;
+
+drop table if exists project_member;
+create table project_member (
+ project_id bigint not null,
+ user_email varchar(255) not null,
+ foreign key(project_id) references project(id) on delete cascade,
+ foreign key(user_email) references users(email) on delete cascade
+);
+
+drop table if exists task;
+create table task (
+ id bigint not null primary key,
+ title varchar(255) not null,
+ done boolean,
+ due_date timestamp,
+ assigned_to varchar(255),
+ project bigint not null,
+ folder varchar(255),
+ foreign key(assigned_to) references users(email) on delete set null,
+ foreign key(project) references project(id) on delete cascade
+);
+
+drop sequence if exists task_seq;
+create sequence task_seq start with 1000;
1  scalikejdbc-play-plugin/test/zentasks/conf/play.plugins
View
@@ -1,3 +1,4 @@
+666:com.github.tototoshi.play2.flyway.Plugin
777:scalikejdbc.PlayPlugin
888:scalikejdbc.PlayFixturePlugin
Something went wrong with that request. Please try again.