Commit 02bc18ec by Tuomas Riihimäki

Add 'placeProduct' field to group_membership in preparation of place reservation explosion

1 parent 0699436d
...@@ -79,7 +79,7 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -79,7 +79,7 @@ public class BootstrapBean implements BootstrapBeanLocal {
dbUpdates.add(new String[] { dbUpdates.add(new String[] {
"alter table compos add hidden boolean default false not null" "alter table compos add hidden boolean default false not null"
}); });
dbUpdates.add(alterTables("ADD COLUMN meta json", dbUpdates.add(alterTables("ADD COLUMN meta json",
"account_events", "account_events",
"actionlog_message_responses", "actionlog_message_responses",
...@@ -151,49 +151,47 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -151,49 +151,47 @@ public class BootstrapBean implements BootstrapBeanLocal {
"user_notes", "user_notes",
"users")); "users"));
dbUpdates.add(new String[] { "CREATE TABLE network_associations (id SERIAL NOT NULL, create_time TIMESTAMPTZ NOT NULL, ip TEXT, mac TEXT, meta TEXT, modify_time TIMESTAMPTZ NOT NULL, status TEXT NOT NULL, event INTEGER, event_user INTEGER, place INTEGER, PRIMARY KEY (id))" });
dbUpdates.add(new String[]{"CREATE TABLE network_associations (id SERIAL NOT NULL, create_time TIMESTAMPTZ NOT NULL, ip TEXT, mac TEXT, meta TEXT, modify_time TIMESTAMPTZ NOT NULL, status TEXT NOT NULL, event INTEGER, event_user INTEGER, place INTEGER, PRIMARY KEY (id))"});
dbUpdates.add(new String[] { dbUpdates.add(new String[] {
"CREATE TABLE card_text_data (id SERIAL NOT NULL, font_name TEXT NOT NULL, font_style INTEGER NOT NULL, size INTEGER NOT NULL, text TEXT, text_alignment TEXT NOT NULL, card_text_data_type TEXT NOT NULL, x INTEGER NOT NULL, y INTEGER NOT NULL, z_index INTEGER NOT NULL, PRIMARY KEY (id));" "CREATE TABLE card_text_data (id SERIAL NOT NULL, font_name TEXT NOT NULL, font_style INTEGER NOT NULL, size INTEGER NOT NULL, text TEXT, text_alignment TEXT NOT NULL, card_text_data_type TEXT NOT NULL, x INTEGER NOT NULL, y INTEGER NOT NULL, z_index INTEGER NOT NULL, PRIMARY KEY (id));"
}); });
dbUpdates.add(new String[] { dbUpdates.add(new String[] {
"CREATE TABLE card_object_data (id SERIAL NOT NULL, card_object_data_type TEXT NOT NULL, size INTEGER NOT NULL, x INTEGER NOT NULL, y INTEGER NOT NULL, z_index INTEGER NOT NULL, PRIMARY KEY (id));" "CREATE TABLE card_object_data (id SERIAL NOT NULL, card_object_data_type TEXT NOT NULL, size INTEGER NOT NULL, x INTEGER NOT NULL, y INTEGER NOT NULL, z_index INTEGER NOT NULL, PRIMARY KEY (id));"
}); });
dbUpdates.add(new String[] { dbUpdates.add(new String[] {
"ALTER TABLE card_text_data ADD COLUMN card_templates_id integer REFERENCES card_templates(id) DEFAULT null;", "ALTER TABLE card_text_data ADD COLUMN card_templates_id integer REFERENCES card_templates(id) DEFAULT null;",
"ALTER TABLE card_object_data ADD COLUMN card_templates_id integer REFERENCES card_templates(id) DEFAULT null;" "ALTER TABLE card_object_data ADD COLUMN card_templates_id integer REFERENCES card_templates(id) DEFAULT null;"
}); });
dbUpdates.add(alterTables("ADD COLUMN meta json", dbUpdates.add(alterTables("ADD COLUMN meta json",
"card_text_data", "card_text_data",
"card_object_data" "card_object_data"
)); ));
dbUpdates.add(new String[] { dbUpdates.add(new String[] {
"ALTER TABLE card_text_data ADD COLUMN font_color_r integer DEFAULT 0;", "ALTER TABLE card_text_data ADD COLUMN font_color_r integer DEFAULT 0;",
"ALTER TABLE card_text_data ADD COLUMN font_color_g integer DEFAULT 0;", "ALTER TABLE card_text_data ADD COLUMN font_color_g integer DEFAULT 0;",
"ALTER TABLE card_text_data ADD COLUMN font_color_b integer DEFAULT 0;" "ALTER TABLE card_text_data ADD COLUMN font_color_b integer DEFAULT 0;"
}); });
dbUpdates.add(new String[] { dbUpdates.add(new String[] {
"ALTER TABLE card_text_data ALTER COLUMN size TYPE numeric(5,2);", "ALTER TABLE card_text_data ALTER COLUMN size TYPE numeric(5,2);",
"ALTER TABLE card_object_data ALTER COLUMN size TYPE numeric(5,2);" "ALTER TABLE card_object_data ALTER COLUMN size TYPE numeric(5,2);"
}); });
dbUpdates.add(new String[] { dbUpdates.add(new String[] {
"ALTER TABLE card_text_data DROP COLUMN font_style;", "ALTER TABLE card_text_data DROP COLUMN font_style;",
"ALTER TABLE card_text_data ADD COLUMN font_style TEXT NOT NULL DEFAULT 'PLAIN';" "ALTER TABLE card_text_data ADD COLUMN font_style TEXT NOT NULL DEFAULT 'PLAIN';"
}); });
dbUpdates.add(new String[] { dbUpdates.add(new String[] {
"ALTER TABLE event_log RENAME log_id TO id;" "ALTER TABLE event_log RENAME log_id TO id;"
}); });
dbUpdates.add(new String[] { dbUpdates.add(new String[] {
"ALTER TABLE network_associations ALTER COLUMN meta TYPE json USING (meta::json);" "ALTER TABLE network_associations ALTER COLUMN meta TYPE json USING (meta::json);"
}); });
dbUpdates.add(new String[] { "CREATE TABLE lecture_groups (id SERIAL NOT NULL, event_id integer NOT NULL, description TEXT, name TEXT, select_count INTEGER, meta json, PRIMARY KEY (id))",
dbUpdates.add(new String[] {"CREATE TABLE lecture_groups (id SERIAL NOT NULL, event_id integer NOT NULL, description TEXT, name TEXT, select_count INTEGER, meta json, PRIMARY KEY (id))",
"CREATE TABLE lectures (id SERIAL NOT NULL, description TEXT, hours numeric(10,2), max_participants_count INTEGER, name TEXT, start_time TIMESTAMPTZ, lecture_group_id INTEGER, meta json, PRIMARY KEY (id))", "CREATE TABLE lectures (id SERIAL NOT NULL, description TEXT, hours numeric(10,2), max_participants_count INTEGER, name TEXT, start_time TIMESTAMPTZ, lecture_group_id INTEGER, meta json, PRIMARY KEY (id))",
"CREATE TABLE lecture_roles (role_id INTEGER NOT NULL, lecture_id INTEGER NOT NULL, PRIMARY KEY (role_id, lecture_id))", "CREATE TABLE lecture_roles (role_id INTEGER NOT NULL, lecture_id INTEGER NOT NULL, PRIMARY KEY (role_id, lecture_id))",
"CREATE TABLE lecture_participants (eventuser_id INTEGER NOT NULL, lecture_id INTEGER NOT NULL, PRIMARY KEY (eventuser_id, lecture_id))", "CREATE TABLE lecture_participants (eventuser_id INTEGER NOT NULL, lecture_id INTEGER NOT NULL, PRIMARY KEY (eventuser_id, lecture_id))",
...@@ -201,9 +199,14 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -201,9 +199,14 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE lecture_roles ADD CONSTRAINT FK_lecture_roles_lecture_id FOREIGN KEY (lecture_id) REFERENCES lectures (id)", "ALTER TABLE lecture_roles ADD CONSTRAINT FK_lecture_roles_lecture_id FOREIGN KEY (lecture_id) REFERENCES lectures (id)",
"ALTER TABLE lecture_roles ADD CONSTRAINT FK_lecture_roles_role_id FOREIGN KEY (role_id) REFERENCES roles (id)", "ALTER TABLE lecture_roles ADD CONSTRAINT FK_lecture_roles_role_id FOREIGN KEY (role_id) REFERENCES roles (id)",
"ALTER TABLE lecture_participants ADD CONSTRAINT FK_lecture_participants_eventuser_id FOREIGN KEY (eventuser_id) REFERENCES event_users (id)", "ALTER TABLE lecture_participants ADD CONSTRAINT FK_lecture_participants_eventuser_id FOREIGN KEY (eventuser_id) REFERENCES event_users (id)",
"ALTER TABLE lecture_participants ADD CONSTRAINT FK_lecture_participants_lecture_id FOREIGN KEY (lecture_id) REFERENCES lectures (id)"}); "ALTER TABLE lecture_participants ADD CONSTRAINT FK_lecture_participants_lecture_id FOREIGN KEY (lecture_id) REFERENCES lectures (id)" });
dbUpdates.add(new String[] { "ALTER TABLE roles ADD COLUMN user_selectable_role boolean DEFAULT false;" }); dbUpdates.add(new String[] { "ALTER TABLE roles ADD COLUMN user_selectable_role boolean DEFAULT false;" });
dbUpdates.add(new String[] {
"ALTER TABLE group_memberships ADD COLUMN place_product INTEGER",
"ALTER TABLE group_memberships ADD CONSTRAINT FK_group_memberships_place_product FOREIGN KEY (place_product) REFERENCES products (id)"
});
} }
@EJB @EJB
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
*/ */
package fi.codecrew.moya.model; package fi.codecrew.moya.model;
import java.beans.Transient;
import java.util.Calendar; import java.util.Calendar;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
...@@ -54,8 +53,11 @@ public class GroupMembership extends GenericEntity { ...@@ -54,8 +53,11 @@ public class GroupMembership extends GenericEntity {
@JoinColumn(name = "place_reservation_id", referencedColumnName = "id", nullable = true, unique = true) @JoinColumn(name = "place_reservation_id", referencedColumnName = "id", nullable = true, unique = true)
private Place placeReservation; private Place placeReservation;
@ManyToOne
@JoinColumn(name = "place_product")
private Product placeProduct;
@JoinColumn(name = EVENTUSER_ID, referencedColumnName = EventUser.ID_COLUMN) @JoinColumn(name = EVENTUSER_ID, referencedColumnName = EventUser.ID_COLUMN)
@ManyToOne @ManyToOne
private EventUser user; private EventUser user;
...@@ -143,4 +145,12 @@ public class GroupMembership extends GenericEntity { ...@@ -143,4 +145,12 @@ public class GroupMembership extends GenericEntity {
public String getInviteToken() { public String getInviteToken() {
return inviteToken; return inviteToken;
} }
public Product getPlaceProduct() {
return placeProduct;
}
public void setPlaceProduct(Product placeProduct) {
this.placeProduct = placeProduct;
}
} }
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
package fi.codecrew.moya.model; package fi.codecrew.moya.model;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -134,9 +132,9 @@ public class Product extends GenericEntity { ...@@ -134,9 +132,9 @@ public class Product extends GenericEntity {
} }
private Product(String string) { private Product(String name) {
super(); super();
name = "----"; this.name = name;
} }
public BigDecimal getSoldCash() { public BigDecimal getSoldCash() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!