1 -- @tag: periodic_invoices
 
   2 -- @description: Neue Tabellen und Spalten für Wiederkehrende Rechnungen
 
   3 -- @depends: release_2_6_1
 
   4 CREATE TABLE periodic_invoices_configs (
 
   5        id                      integer     NOT NULL DEFAULT nextval('id'),
 
   6        oe_id                   integer     NOT NULL,
 
   7        periodicity             varchar(10) NOT NULL,
 
   8        print                   boolean               DEFAULT 'f',
 
  11        active                  boolean               DEFAULT 't',
 
  12        terminated              boolean               DEFAULT 'f',
 
  15        ar_chart_id             integer     NOT NULL,
 
  16        extend_automatically_by integer,
 
  19        FOREIGN KEY (oe_id)       REFERENCES oe       (id),
 
  20        FOREIGN KEY (printer_id)  REFERENCES printers (id),
 
  21        FOREIGN KEY (ar_chart_id) REFERENCES chart    (id)
 
  24 CREATE TABLE periodic_invoices (
 
  25        id                integer   NOT NULL DEFAULT nextval('id'),
 
  26        config_id         integer   NOT NULL,
 
  27        ar_id             integer   NOT NULL,
 
  28        period_start_date date      NOT NULL,
 
  29        itime             timestamp          DEFAULT now(),
 
  32        FOREIGN KEY (config_id) REFERENCES periodic_invoices_configs (id),
 
  33        FOREIGN KEY (ar_id)     REFERENCES ar                        (id)