diff --git a/src/de/jost_net/JVerein/gui/action/DbBereinigenAction.java b/src/de/jost_net/JVerein/gui/action/DbBereinigenAction.java new file mode 100644 index 000000000..f4d22128a --- /dev/null +++ b/src/de/jost_net/JVerein/gui/action/DbBereinigenAction.java @@ -0,0 +1,35 @@ +/********************************************************************** + * Copyright (c) by Heiner Jostkleigrewe + * This program is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program. If not, + * see . + * + * heiner@jverein.de + * www.jverein.de + **********************************************************************/ +package de.jost_net.JVerein.gui.action; + +import de.jost_net.JVerein.gui.view.DbBereinigenView; +import de.willuhn.jameica.gui.Action; +import de.willuhn.jameica.gui.GUI; +import de.willuhn.util.ApplicationException; + +/** + * Loeschen einer Buchung. + */ +public class DbBereinigenAction implements Action +{ + + @Override + public void handleAction(Object context) throws ApplicationException + { + GUI.startView(DbBereinigenView.class.getName(), null); + } +} diff --git a/src/de/jost_net/JVerein/gui/control/DbBereinigenControl.java b/src/de/jost_net/JVerein/gui/control/DbBereinigenControl.java new file mode 100644 index 000000000..314567d1c --- /dev/null +++ b/src/de/jost_net/JVerein/gui/control/DbBereinigenControl.java @@ -0,0 +1,386 @@ +/********************************************************************** + * Copyright (c) by Heiner Jostkleigrewe + * This program is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program. If not, + * see . + * + * heiner@jverein.de + * www.jverein.de + **********************************************************************/ +package de.jost_net.JVerein.gui.control; + +import java.rmi.RemoteException; +import java.util.Calendar; +import java.util.Date; + +import de.jost_net.JVerein.Einstellungen; +import de.jost_net.JVerein.rmi.Buchung; +import de.jost_net.JVerein.rmi.Lastschrift; +import de.jost_net.JVerein.rmi.Mail; +import de.willuhn.datasource.rmi.DBIterator; +import de.willuhn.jameica.gui.AbstractControl; +import de.willuhn.jameica.gui.AbstractView; +import de.willuhn.jameica.gui.Action; +import de.willuhn.jameica.gui.GUI; +import de.willuhn.jameica.gui.input.CheckboxInput; +import de.willuhn.jameica.gui.input.DateInput; +import de.willuhn.jameica.gui.parts.Button; +import de.willuhn.jameica.system.Application; +import de.willuhn.jameica.system.BackgroundTask; +import de.willuhn.jameica.system.OperationCanceledException; +import de.willuhn.jameica.system.Settings; +import de.willuhn.logging.Logger; +import de.willuhn.util.ProgressMonitor; + +public class DbBereinigenControl extends AbstractControl +{ + + private Settings settings = null; + + private double anzahl = 3.0d; + + // Buchungen loeschen + private CheckboxInput bLoeschenInput = null; + private DateInput bDateInput = null; + private CheckboxInput sLoeschenInput = null; + + //Lastschriften loeschen + private CheckboxInput lLoeschenInput = null; + private DateInput lDateInput = null; + + //Mails loeschen + private CheckboxInput mLoeschenInput = null; + private DateInput mDateInput = null; + + public DbBereinigenControl(AbstractView view) + { + super(view); + settings = new Settings(this.getClass()); + settings.setStoreWhenRead(true); + } + + + public Button getStartLoeschenButton() + { + Button b = new Button("Starten", new Action() + { + + @Override + public void handleAction(Object context) + { + try + { + runDelete((boolean) bLoeschenInput.getValue(), (Date) bDateInput.getValue(), + (boolean) sLoeschenInput.getValue(), + (boolean) lLoeschenInput.getValue(), (Date) lDateInput.getValue(), + (boolean) mLoeschenInput.getValue(), (Date) mDateInput.getValue()); + } + catch (Exception e) + { + Logger.error("Fehler", e); + GUI.getStatusBar().setErrorText(e.getMessage()); + } + } + }, null, true, "walking.png"); // "true" defines this button as the default + // button + return b; + } + + + private void runDelete(final boolean bloeschen, final Date bdate, + final boolean sloeschen, + final boolean lloeschen, final Date ldate, + final boolean mloeschen, final Date mdate) throws RemoteException + { + BackgroundTask t = new BackgroundTask() + { + @Override + public void run(ProgressMonitor monitor) + { + try + { + monitor.setStatus(ProgressMonitor.STATUS_RUNNING); + monitor.setPercentComplete(0); + double progress = 1.0d; + + // Buchungen löschen + if ( bloeschen && bdate == null) + { + monitor.log("Buchungen löschen: Kein gültiges Datum eingegeben"); + } + else if ( bloeschen && bdate != null) + { + buchungenLoeschen(monitor, bdate, sloeschen); + } + monitor.setPercentComplete((int) (progress / anzahl * 100d)); + progress++; + + // Lastschriften löschen + if ( lloeschen && ldate == null) + { + monitor.log("Lastschriften löschen: Kein gültiges Datum eingegeben"); + } + else if ( lloeschen && ldate != null) + { + lastschriftenLoeschen(monitor, ldate); + } + monitor.setPercentComplete((int) (progress / anzahl * 100d)); + progress++; + + // Mails löschen + if ( mloeschen && mdate == null) + { + monitor.log("Mails löschen: Kein gültiges Datum eingegeben"); + } + else if ( mloeschen && mdate != null) + { + mailsLoeschen(monitor, mdate); + } + + monitor.setPercentComplete(100); + monitor.setStatus(ProgressMonitor.STATUS_DONE); + monitor.setStatusText("Bereinigung beendet"); + GUI.getStatusBar().setSuccessText("Bereinigung beendet"); + } + catch (Exception re) + { + Logger.error("", re); + monitor.log(re.getMessage()); + } + } + + @Override + public void interrupt() + { + // + } + + @Override + public boolean isInterrupted() + { + return false; + } + }; + Application.getController().start(t); + } + + + // Buchungen loeschen + public CheckboxInput getBuchungenLoeschen() + { + if (bLoeschenInput != null) + { + return bLoeschenInput; + } + bLoeschenInput = new CheckboxInput(false); + return bLoeschenInput; + } + + public DateInput getDatumAuswahlBuchungen() + { + if (bDateInput != null) + { + return bDateInput; + } + Calendar cal = Calendar.getInstance(); + int year = cal.get(Calendar.YEAR); + cal.set(Calendar.YEAR, year-11); + cal.set(Calendar.MONTH, Calendar.JANUARY); + cal.set(Calendar.DAY_OF_MONTH, 1); + bDateInput = new DateInput(new Date(cal.getTimeInMillis())); + return bDateInput; + } + + public CheckboxInput getSollbuchungenLoeschen() + { + if (sLoeschenInput != null) + { + return sLoeschenInput; + } + sLoeschenInput = new CheckboxInput(true); + return sLoeschenInput; + } + + // Lastschriften loeschen + public CheckboxInput getLastschriftenLoeschen() + { + if (lLoeschenInput != null) + { + return lLoeschenInput; + } + lLoeschenInput = new CheckboxInput(false); + return lLoeschenInput; + } + + public DateInput getDatumAuswahlLastschriften() + { + if (lDateInput != null) + { + return lDateInput; + } + Calendar cal = Calendar.getInstance(); + int year = cal.get(Calendar.YEAR); + cal.set(Calendar.YEAR, year-11); + cal.set(Calendar.MONTH, Calendar.JANUARY); + cal.set(Calendar.DAY_OF_MONTH, 1); + lDateInput = new DateInput(new Date(cal.getTimeInMillis())); + return lDateInput; + } + + // Mails loeschen + public CheckboxInput getMailsLoeschen() + { + if (mLoeschenInput != null) + { + return mLoeschenInput; + } + mLoeschenInput = new CheckboxInput(false); + return mLoeschenInput; + } + + public DateInput getDatumAuswahlMails() + { + if (mDateInput != null) + { + return mDateInput; + } + Calendar cal = Calendar.getInstance(); + int year = cal.get(Calendar.YEAR); + cal.set(Calendar.YEAR, year-11); + cal.set(Calendar.MONTH, Calendar.JANUARY); + cal.set(Calendar.DAY_OF_MONTH, 1); + mDateInput = new DateInput(new Date(cal.getTimeInMillis())); + return mDateInput; + } + + // Lösch Aktionen + private void buchungenLoeschen(ProgressMonitor monitor, final Date date, final boolean sloeschen) + { + try + { + DBIterator it = Einstellungen.getDBService() + .createList(Buchung.class); + it.addFilter("datum < ?", date); + int count = 0; + Buchung b = null; + while (it.hasNext()) + { + b = it.next(); + try + { + if (sloeschen && (b.getMitgliedskonto() != null)) + { + b.getMitgliedskonto().delete(); + } + } + catch (Exception e) + { + // Das kann passieren wenn der Sollbuchung mehrere Buchungen + // zugeordnet waren. Dann existiert die Sollbuchung nicht mehr + // bei den weiteren Buchungen da das Query vorher erfolgt ist + } + b.delete(); + count++; + } + if (count > 0) + { + monitor.setStatusText(String.format( + "%d Buchung" + (count != 1 ? "en" : "") + " gelöscht.", count)); + } + else + { + monitor.log("Keine Buchungen im vorgegebenen Zeitraum vorhanden!"); + } + } + catch (OperationCanceledException oce) + { + throw oce; + } + catch (Exception e) + { + String fehler = "Fehler beim Löschen von Buchungen."; + monitor.setStatusText(fehler); + Logger.error(fehler, e); + } + } + + private void lastschriftenLoeschen(ProgressMonitor monitor, final Date date) + { + try + { + DBIterator it = Einstellungen.getDBService() + .createList(Lastschrift.class); + it.join("abrechnungslauf"); + it.addFilter("abrechnungslauf.id = lastschrift.abrechnungslauf"); + it.addFilter("faelligkeit < ?", date); + int count = 0; + while (it.hasNext()) + { + it.next().delete();; + count++; + } + if (count > 0) + { + monitor.setStatusText(String.format( + "%d Lastschrift" + (count != 1 ? "en" : "") + " gelöscht.", count)); + } + else + { + monitor.log("Keine Lastschriften im vorgegebenen Zeitraum vorhanden!"); + } + } + catch (OperationCanceledException oce) + { + throw oce; + } + catch (Exception e) + { + String fehler = "Fehler beim Löschen von Lastschriften."; + monitor.setStatusText(fehler); + Logger.error(fehler, e); + } + } + + private void mailsLoeschen(ProgressMonitor monitor, final Date date) + { + try + { + DBIterator it = Einstellungen.getDBService() + .createList(Mail.class); + it.addFilter("versand < ?", date); + int count = 0; + while (it.hasNext()) + { + it.next().delete();; + count++; + } + if (count > 0) + { + monitor.setStatusText(String.format( + "%d Mail" + (count != 1 ? "s" : "") + " gelöscht.", count)); + } + else + { + monitor.log("Keine Mails im vorgegebenen Zeitraum vorhanden!"); + } + } + catch (OperationCanceledException oce) + { + throw oce; + } + catch (Exception e) + { + String fehler = "Fehler beim Löschen von Mails."; + monitor.setStatusText(fehler); + Logger.error(fehler, e); + } + } + +} diff --git a/src/de/jost_net/JVerein/gui/navigation/MyExtension.java b/src/de/jost_net/JVerein/gui/navigation/MyExtension.java index fe2a9b54e..f540a8744 100644 --- a/src/de/jost_net/JVerein/gui/navigation/MyExtension.java +++ b/src/de/jost_net/JVerein/gui/navigation/MyExtension.java @@ -48,6 +48,7 @@ import de.jost_net.JVerein.gui.action.BuchungsklasseListAction; import de.jost_net.JVerein.gui.action.BuchungsklasseSaldoAction; import de.jost_net.JVerein.gui.action.BuchungsuebernahmeAction; +import de.jost_net.JVerein.gui.action.DbBereinigenAction; import de.jost_net.JVerein.gui.action.DokumentationAction; import de.jost_net.JVerein.gui.action.EigenschaftGruppeListeAction; import de.jost_net.JVerein.gui.action.EigenschaftListeAction; @@ -75,7 +76,6 @@ import de.jost_net.JVerein.gui.action.ProjektListAction; import de.jost_net.JVerein.gui.action.ProjektSaldoAction; import de.jost_net.JVerein.gui.action.QIFBuchungsImportViewAction; -import de.jost_net.JVerein.gui.action.SpendenAction; import de.jost_net.JVerein.gui.action.SpendenbescheinigungListeAction; import de.jost_net.JVerein.gui.action.StatistikJahrgaengeAction; import de.jost_net.JVerein.gui.action.StatistikMitgliedAction; @@ -197,7 +197,7 @@ public void extend(Extendable extendable) mail.addChild(new MyItem(mail, "Mail-Vorlagen", new MailVorlagenAction(), "envelope-open.png")); jverein.addChild(mail); - + NavigationItem buchfuehrung = null; buchfuehrung = new MyItem(buchfuehrung, "Buchführung", null); buchfuehrung.addChild(new MyItem(buchfuehrung, "Konten", @@ -284,19 +284,21 @@ public void extend(Extendable extendable) "Projekte", new ProjektListAction(), "screwdriver.png")); administration.addChild(einstellungenbuchfuehrung); - - administration.addChild(new MyItem(administration, "Beitragsgruppen", + NavigationItem einstellungenmitglieder = null; + einstellungenmitglieder = new MyItem(einstellungenmitglieder, + "Mitglieder", null); + einstellungenmitglieder.addChild(new MyItem(einstellungenmitglieder, "Beitragsgruppen", new BeitragsgruppeSucheAction(), "clone.png")); - administration - .addChild(new MyItem(administration, "Eigenschaften-Gruppen", + einstellungenmitglieder + .addChild(new MyItem(einstellungenmitglieder, "Eigenschaften-Gruppen", new EigenschaftGruppeListeAction(), "ellipsis-v.png")); - administration.addChild(new MyItem(administration, "Eigenschaften", + einstellungenmitglieder.addChild(new MyItem(einstellungenmitglieder, "Eigenschaften", new EigenschaftListeAction(), "ellipsis-v.png")); - administration.addChild(new MyItem(administration, "Felddefinitionen", + einstellungenmitglieder.addChild(new MyItem(einstellungenmitglieder, "Felddefinitionen", new FelddefinitionenAction(), "list.png")); if (Einstellungen.getEinstellung().getUseLesefelder()) { - administration.addChild(new MyItem(administration, "Lesefelder", + einstellungenmitglieder.addChild(new MyItem(einstellungenmitglieder, "Lesefelder", new LesefelddefinitionenAction(null), "list.png")); } // TODO deaktiviert für Versionsbau @@ -306,23 +308,27 @@ public void extend(Extendable extendable) // "Inventar-Lager", new InventarLagerortListeAction(), // "category_obj.gif")); // } - administration.addChild(new MyItem(administration, "Formulare", + einstellungenmitglieder.addChild(new MyItem(einstellungenmitglieder, "Formulare", new FormularListeAction(), "columns.png")); if (Einstellungen.getEinstellung().getLehrgaenge()) { - administration.addChild(new MyItem(administration, "Lehrgangsarten", + einstellungenmitglieder.addChild(new MyItem(einstellungenmitglieder, "Lehrgangsarten", new LehrgangsartListeAction(), "chalkboard-teacher.png")); } - administration.addChild(new MyItem(administration, "Import", + einstellungenmitglieder.addChild(new MyItem(einstellungenmitglieder, "Import", new MitgliedImportAction(), "file-import.png")); if (Einstellungen.getEinstellung().getZusatzadressen()) { - administration.addChild(new MyItem(administration, "Mitgliedstypen", + einstellungenmitglieder.addChild(new MyItem(einstellungenmitglieder, "Mitgliedstypen", new MitgliedstypListAction(), "columns.png")); } + administration.addChild(einstellungenmitglieder); + NavigationItem einstellungenerweitert = null; einstellungenerweitert = new MyItem(einstellungenerweitert, "Erweitert", null); + einstellungenerweitert.addChild(new MyItem(einstellungenerweitert, + "Datenbank bereinigen", new DbBereinigenAction(), "placeholder-loading.png")); einstellungenerweitert.addChild(new MyItem(einstellungenerweitert, "Diagnose-Backup erstellen", new BackupCreateAction(), "document-save.png")); einstellungenerweitert.addChild( diff --git a/src/de/jost_net/JVerein/gui/view/DbBereinigenView.java b/src/de/jost_net/JVerein/gui/view/DbBereinigenView.java new file mode 100644 index 000000000..993fc065e --- /dev/null +++ b/src/de/jost_net/JVerein/gui/view/DbBereinigenView.java @@ -0,0 +1,66 @@ +/********************************************************************** + * Copyright (c) by Heiner Jostkleigrewe + * This program is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program. If not, + * see . + * + * heiner@jverein.de + * www.jverein.de + **********************************************************************/ +package de.jost_net.JVerein.gui.view; + +import de.jost_net.JVerein.gui.action.DokumentationAction; +import de.jost_net.JVerein.gui.control.DbBereinigenControl; +import de.willuhn.jameica.gui.AbstractView; +import de.willuhn.jameica.gui.GUI; +import de.willuhn.jameica.gui.parts.ButtonArea; +import de.willuhn.jameica.gui.util.ColumnLayout; +import de.willuhn.jameica.gui.util.LabelGroup; +import de.willuhn.jameica.gui.util.SimpleContainer; + +public class DbBereinigenView extends AbstractView +{ + + @Override + public void bind() throws Exception + { + GUI.getView().setTitle("Datenbank bereinigen"); + + final DbBereinigenControl control = new DbBereinigenControl(this); + + LabelGroup groupbuchungen = new LabelGroup(getParent(), "Buchungen"); + ColumnLayout bcl = new ColumnLayout(groupbuchungen.getComposite(), 2); + SimpleContainer bleft = new SimpleContainer(bcl.getComposite()); + bleft.addLabelPair("Löschen", control.getBuchungenLoeschen()); + SimpleContainer bright = new SimpleContainer(bcl.getComposite()); + bright.addLabelPair("Datum älter als", control.getDatumAuswahlBuchungen()); + bright.addLabelPair("Zugeordnete Sollbuchungen löschen", control.getSollbuchungenLoeschen()); + + LabelGroup grouplastschriften = new LabelGroup(getParent(), "Lastschriften"); + ColumnLayout lcl = new ColumnLayout(grouplastschriften.getComposite(), 2); + SimpleContainer lleft = new SimpleContainer(lcl.getComposite()); + lleft.addLabelPair("Löschen", control.getLastschriftenLoeschen()); + SimpleContainer lright = new SimpleContainer(lcl.getComposite()); + lright.addLabelPair("Fälligkeit älter als", control.getDatumAuswahlLastschriften()); + + LabelGroup groupmails = new LabelGroup(getParent(), "Mails"); + ColumnLayout mcl = new ColumnLayout(groupmails.getComposite(), 2); + SimpleContainer mleft = new SimpleContainer(mcl.getComposite()); + mleft.addLabelPair("Löschen", control.getMailsLoeschen()); + SimpleContainer mright = new SimpleContainer(mcl.getComposite()); + mright.addLabelPair("Versand älter als", control.getDatumAuswahlMails()); + + ButtonArea buttons = new ButtonArea(); + buttons.addButton("Hilfe", new DokumentationAction(), + DokumentationUtil.BEREINIGEN, false, "question-circle.png"); + buttons.addButton(control.getStartLoeschenButton()); + buttons.paint(this.getParent()); + } +} diff --git a/src/de/jost_net/JVerein/gui/view/DokumentationUtil.java b/src/de/jost_net/JVerein/gui/view/DokumentationUtil.java index 659eb86ad..3eb7719fc 100644 --- a/src/de/jost_net/JVerein/gui/view/DokumentationUtil.java +++ b/src/de/jost_net/JVerein/gui/view/DokumentationUtil.java @@ -95,6 +95,8 @@ public class DokumentationUtil public static final String JUBILAEEN = PRE + FUNKTIONEN + AUSWERTUNGEN + "jubilaen"; public static final String LEHRGANG = PRE + FUNKTIONEN + ADMIN + "lehrgange"; + + public static final String BEREINIGEN = PRE + FUNKTIONEN + ADMIN + "bereinigen"; public static final String KONTENRAHMEN = PRE + FUNKTIONEN + ADMIN + ADMBUCHF + "kontenrahmen-import-export"; diff --git a/src/de/jost_net/JVerein/server/BuchungImpl.java b/src/de/jost_net/JVerein/server/BuchungImpl.java index f9d7ed8e3..418f8dc3b 100644 --- a/src/de/jost_net/JVerein/server/BuchungImpl.java +++ b/src/de/jost_net/JVerein/server/BuchungImpl.java @@ -69,7 +69,7 @@ public String getPrimaryAttribute() @Override protected void deleteCheck() throws ApplicationException { - insertCheck(); + //insertCheck(); } @Override diff --git a/src/de/jost_net/JVerein/server/DDLTool/AbstractDDLUpdate.java b/src/de/jost_net/JVerein/server/DDLTool/AbstractDDLUpdate.java index 08ee6f04f..1e462cd55 100644 --- a/src/de/jost_net/JVerein/server/DDLTool/AbstractDDLUpdate.java +++ b/src/de/jost_net/JVerein/server/DDLTool/AbstractDDLUpdate.java @@ -302,8 +302,8 @@ public String createForeignKey(String constraintname, String table, } case MYSQL: { - return "ALTER TABLE " + table + " ADD CONSTRAINT " + " FOREIGN KEY " - + constraintname + "(" + column + ") REFERENCES " + reftable + " (" + return "ALTER TABLE " + table + " ADD CONSTRAINT " + constraintname + + " FOREIGN KEY (" + column + ") REFERENCES " + reftable + "(" + refcolumn + ") ON DELETE " + ondelete + " ON UPDATE " + onupdate + ";\n"; } @@ -328,8 +328,8 @@ public void createForeignKeyIfNotExistsNocheck(String constraintname, String tab break; case MYSQL: { - String statement = "ALTER TABLE " + table + " ADD CONSTRAINT " + " FOREIGN KEY " - + constraintname + "(" + column + ") REFERENCES " + reftable + " (" + String statement = "ALTER TABLE " + table + " ADD CONSTRAINT " + constraintname + + " FOREIGN KEY (" + column + ") REFERENCES " + reftable + " (" + refcolumn + ") ON DELETE " + ondelete + " ON UPDATE " + onupdate + ";\n"; try @@ -350,5 +350,21 @@ public String dropTable(String table) { return "drop table " + table + ";\n"; } + + public String dropForeignKey(String constraintname, String table) + { + switch (drv) + { + case H2: + { + return "ALTER TABLE " + table + " DROP CONSTRAINT " + constraintname + ";\n"; + } + case MYSQL: + { + return "ALTER TABLE " + table + " DROP FOREIGN KEY " + constraintname + ";\n"; + } + } + return ""; + } } diff --git a/src/de/jost_net/JVerein/server/DDLTool/Updates/Update0441.java b/src/de/jost_net/JVerein/server/DDLTool/Updates/Update0441.java new file mode 100644 index 000000000..6930c0a0a --- /dev/null +++ b/src/de/jost_net/JVerein/server/DDLTool/Updates/Update0441.java @@ -0,0 +1,40 @@ +/********************************************************************** + * This program is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program. If not, + * see . + * + **********************************************************************/ +package de.jost_net.JVerein.server.DDLTool.Updates; + +import de.jost_net.JVerein.server.DDLTool.AbstractDDLUpdate; +import de.willuhn.util.ApplicationException; +import de.willuhn.util.ProgressMonitor; + +import java.sql.Connection; + +public class Update0441 extends AbstractDDLUpdate +{ + public Update0441(String driver, ProgressMonitor monitor, Connection conn) + { + super(driver, monitor, conn); + } + + @Override + public void run() throws ApplicationException + { + execute(dropForeignKey("fkBuchungDokument1", "buchungdokument")); + execute(createForeignKey("fkBuchungDokument1", "buchungdokument", + "referenz", "buchung", "id", "CASCADE", "NO ACTION")); + + execute(dropForeignKey("fkBuchung3", "buchung")); + execute(createForeignKey("fkBuchung3", "buchung", + "mitgliedskonto", "mitgliedskonto", "id", "SET NULL", "NO ACTION")); + } +}