Commit 802b96bf by Juho Juopperi

add all GenericEntity tables to dbudater for adding meta field. Also rename lice…

…nseTargets to licensetargets as it has really been generated lowercase in existing databases
1 parent 77d5f1f6
...@@ -24,15 +24,20 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -24,15 +24,20 @@ public class BootstrapBean implements BootstrapBeanLocal {
} }
/** /**
* Runs a "ALTER TABLE <table> <statement>" for each of tables. * Runs a "ALTER TABLE
* @param alterStatement e.g. "ADD meta json" * <table>
* @param tables table name strings * <statement>" for each of tables.
*
* @param alterStatement
* e.g. "ADD meta json"
* @param tables
* table name strings
* @return1 * @return1
*/ */
private static final String[] alterTables(String alterStatement, String... tables) { private static final String[] alterTables(String alterStatement, String... tables) {
String[] strings = new String[tables.length]; String[] strings = new String[tables.length];
for (int i=0; i<tables.length; i++) { for (int i = 0; i < tables.length; i++) {
strings[i] = "ALTER TABLE \""+ tables[i] + "\" " + alterStatement; strings[i] = "ALTER TABLE \"" + tables[i] + "\" " + alterStatement;
} }
return strings; return strings;
} }
...@@ -74,7 +79,76 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -74,7 +79,76 @@ 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", "account_events", "actionlog_messages", "actionlog_message_responses", "application_permissions", "approvals", "bills", "bill_lines", "card_barcode", "card_templates", "compos", "compo_entries", "compo_entry_files", "compo_entry_participations", "db_models", "discounts", "discount_instances")); dbUpdates.add(alterTables("ADD COLUMN meta json",
"account_events",
"actionlog_message_responses",
"actionlog_message_tags",
"actionlog_messages",
"api_application_instances",
"api_applications",
"application_permissions",
"approvals",
"bill_lines",
"bills",
"card_code",
"card_templates",
"compo_entries",
"compo_entry_files",
"compo_entry_participations",
"compo_votes",
"compos",
"discount_instances",
"discounts",
"event_domains",
"event_log",
"event_log_types",
"event_organiser",
"event_private_properties",
"event_properties",
"event_users",
"events",
"feedback",
"food_wave_templates",
"food_waves",
"game_ids",
"group_memberships",
"groups",
"inventory_events",
"licensetargets",
"licensecodes",
"locations",
"maps",
"match_results",
"matches",
"menu_navigation",
"menuitem",
"news",
"news_groups",
"org_roles",
"places",
"poll",
"poll_answer",
"poll_question",
"possible_answer",
"printed_cards",
"product_limitations",
"products",
"reader_events",
"readers",
"roles",
"sales_entity",
"salespoint",
"site_page_content",
"site_pages",
"tournament_games",
"tournament_participants",
"tournament_rules",
"tournament_team_members",
"tournaments",
"user_approvals",
"user_images",
"user_notes",
"users"));
} }
@EJB @EJB
......
...@@ -22,7 +22,7 @@ import org.eclipse.persistence.annotations.OptimisticLockingType; ...@@ -22,7 +22,7 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
* *
*/ */
@Entity @Entity
@Table(name = "licenseTargets") @Table(name = "licensetargets")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS) @OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class LicenseTarget extends GenericEntity { public class LicenseTarget extends GenericEntity {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!