Permalink
Browse files

do not use a table named user

  • Loading branch information...
1 parent 03a1f10 commit f273c8e6684005394183304dcb718d1778e80251 @jamesward committed Feb 3, 2012
Showing with 14 additions and 160 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 app/models/User.java
  3. +12 −12 conf/evolutions/default/1.sql
  4. +0 −52 db/evolutions/default/1.sql
  5. +0 −96 logs/application.log
View
1 .gitignore
@@ -1 +1,2 @@
target
+logs
View
1 app/models/User.java
@@ -13,6 +13,7 @@
* User entity managed by Ebean
*/
@Entity
+@Table(name="account")
public class User extends Model {
@Id
View
24 conf/evolutions/default/1.sql
@@ -21,53 +21,53 @@ create table task (
constraint pk_task primary key (id))
;
-create table user (
+create table account (
email varchar(255) not null,
name varchar(255),
password varchar(255),
- constraint pk_user primary key (email))
+ constraint pk_account primary key (email))
;
-create table project_user (
+create table project_account (
project_id bigint not null,
- user_email varchar(255) not null,
- constraint pk_project_user primary key (project_id, user_email))
+ account_email varchar(255) not null,
+ constraint pk_project_account primary key (project_id, account_email))
;
create sequence project_seq;
create sequence task_seq;
-create sequence user_seq;
+create sequence account_seq;
-alter table task add constraint fk_task_assignedTo_1 foreign key (assigned_to_email) references user (email) on delete restrict on update restrict;
+alter table task add constraint fk_task_assignedTo_1 foreign key (assigned_to_email) references account (email) on delete restrict on update restrict;
create index ix_task_assignedTo_1 on task (assigned_to_email);
alter table task add constraint fk_task_project_2 foreign key (project_id) references project (id) on delete restrict on update restrict;
create index ix_task_project_2 on task (project_id);
-alter table project_user add constraint fk_project_user_project_01 foreign key (project_id) references project (id) on delete restrict on update restrict;
+alter table project_account add constraint fk_project_account_project_01 foreign key (project_id) references project (id) on delete restrict on update restrict;
-alter table project_user add constraint fk_project_user_user_02 foreign key (user_email) references user (email) on delete restrict on update restrict;
+alter table project_account add constraint fk_project_account_account_02 foreign key (account_email) references account (email) on delete restrict on update restrict;
# --- !Downs
SET REFERENTIAL_INTEGRITY FALSE;
drop table if exists project;
-drop table if exists project_user;
+drop table if exists project_account;
drop table if exists task;
-drop table if exists user;
+drop table if exists account;
SET REFERENTIAL_INTEGRITY TRUE;
drop sequence if exists project_seq;
drop sequence if exists task_seq;
-drop sequence if exists user_seq;
+drop sequence if exists account_seq;
View
52 db/evolutions/default/1.sql
@@ -1,52 +0,0 @@
-
-# --- !Ups
-
-create table user (
- email varchar(255) not null,
- name varchar(255),
- password varchar(255),
- constraint pk_user primary key (email)
-);
-
-create table project (
- id bigint not null,
- name varchar(255),
- folder varchar(255),
- constraint pk_project primary key (id)
-);
-
-create table task (
- id bigint not null,
- title varchar(255),
- done boolean,
- due_date timestamp,
- assigned_to_email varchar(255),
- folder varchar(255),
- project_id bigint,
- constraint pk_task primary key (id),
- foreign key (assigned_to_email) references user (email) on delete set null on update restrict,
- foreign key (project_id) references project (id) on delete cascade on update restrict
-);
-
-create table project_user (
- project_id bigint not null,
- user_email varchar(255) not null,
- constraint pk_project_user primary key (project_id, user_email),
- foreign key (project_id) references project (id) on delete cascade on update restrict,
- foreign key (user_email) references user (email) on delete cascade on update restrict
-);
-
-create sequence project_seq start with 1000;
-create sequence task_seq start with 1000;
-
-# --- !Downs
-
-drop table if exists task;
-drop table if exists project_user;
-drop table if exists project;
-drop table if exists user;
-
-drop sequence if exists project_seq;
-drop sequence if exists task_seq;
-
-
View
96 logs/application.log
@@ -1,96 +0,0 @@
-2012-02-02 18:50:35,945 - [INFO] - from play in main
-Listening for HTTP on port 9000...
-
-2012-02-02 18:50:50,390 - [INFO] - from play in default-dispatcher4
-database [default] connected at jdbc:h2:mem:play
-
-2012-02-02 18:50:51,301 - [ERROR] - from application in New I/O server worker #1-1
-
-
-! @699h6ajoh - Internal server error, for request [GET /] ->
-
-play.api.db.evolutions.InvalidDatabaseRevision: Database 'default' needs evolution! [An SQL script need to be run on your database.]
- at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:422) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:409) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) ~[scala-library.jar:0.11.2]
- at scala.collection.immutable.List.foreach(List.scala:45) ~[scala-library.jar:0.11.2]
- at play.api.db.evolutions.EvolutionsPlugin.onStart(Evolutions.scala:409) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at play.api.Play$$anonfun$start$1.apply(Play.scala:60) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at play.api.Play$$anonfun$start$1.apply(Play.scala:60) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) ~[scala-library.jar:0.11.2]
- at scala.collection.immutable.List.foreach(List.scala:45) ~[scala-library.jar:0.11.2]
- at play.api.Play$.start(Play.scala:60) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$$anonfun$1.apply(ApplicationProvider.scala:104) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3$$anonfun$1.apply(ApplicationProvider.scala:91) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2]
- at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3.apply(ApplicationProvider.scala:91) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$3.apply(ApplicationProvider.scala:89) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at scala.Either$RightProjection.flatMap(Either.scala:277) ~[scala-library.jar:0.11.2]
- at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:89) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:89) ~[play_2.9.1.jar:2.0-RC1-SNAPSHOT]
- at akka.dispatch.Future$$anon$3.liftedTree1$1(Future.scala:149) ~[akka-actor-2.0-M2.jar:2.0-M2]
- at akka.dispatch.Future$$anon$3.run(Future.scala:148) ~[akka-actor-2.0-M2.jar:2.0-M2]
- at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:80) ~[akka-actor-2.0-M2.jar:2.0-M2]
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.6.0_24]
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.6.0_24]
- at java.lang.Thread.run(Thread.java:679) [na:1.6.0_24]
-
-2012-02-02 18:51:07,537 - [WARN] - from play in New I/O server worker #1-1
-Applying evolution script for database 'default':
-
-# --- Rev:1,Ups - b431ccc
-create table project (
-id bigint not null,
-name varchar(255),
-folder varchar(255),
-constraint pk_project primary key (id))
-;
-
-create table task (
-id bigint not null,
-title varchar(255),
-done boolean,
-due_date timestamp,
-assigned_to_email varchar(255),
-folder varchar(255),
-project_id bigint,
-constraint pk_task primary key (id))
-;
-
-create table user (
-email varchar(255) not null,
-name varchar(255),
-password varchar(255),
-constraint pk_user primary key (email))
-;
-
-
-create table project_user (
-project_id bigint not null,
-user_email varchar(255) not null,
-constraint pk_project_user primary key (project_id, user_email))
-;
-create sequence project_seq;
-
-create sequence task_seq;
-
-create sequence user_seq;
-
-alter table task add constraint fk_task_assignedTo_1 foreign key (assigned_to_email) references user (email) on delete restrict on update restrict;
-create index ix_task_assignedTo_1 on task (assigned_to_email);
-alter table task add constraint fk_task_project_2 foreign key (project_id) references project (id) on delete restrict on update restrict;
-create index ix_task_project_2 on task (project_id);
-
-
-
-alter table project_user add constraint fk_project_user_project_01 foreign key (project_id) references project (id) on delete restrict on update restrict;
-
-alter table project_user add constraint fk_project_user_user_02 foreign key (user_email) references user (email) on delete restrict on update restrict;
-
-
-2012-02-02 18:51:07,974 - [INFO] - from play in default-dispatcher1
-database [default] connected at jdbc:h2:mem:play
-
-2012-02-02 18:51:08,402 - [INFO] - from play in default-dispatcher1
-Application started (Dev)
-

0 comments on commit f273c8e

Please sign in to comment.