Datenbankschema & Models für Hintergrundjobs
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 29 Oct 2010 10:52:48 +0000 (12:52 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 12 Jan 2011 10:13:35 +0000 (11:13 +0100)
SL/DB/BackgroundJob.pm [new file with mode: 0644]
SL/DB/BackgroundJobHistory.pm [new file with mode: 0644]
SL/DB/Helper/ALL.pm
SL/DB/Helper/Mappings.pm
SL/DB/MetaSetup/BackgroundJob.pm [new file with mode: 0644]
SL/DB/MetaSetup/BackgroundJobHistory.pm [new file with mode: 0644]
sql/Pg-upgrade2/emmvee_background_jobs.sql [new file with mode: 0644]

diff --git a/SL/DB/BackgroundJob.pm b/SL/DB/BackgroundJob.pm
new file mode 100644 (file)
index 0000000..e6b099f
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::BackgroundJob;
+
+use strict;
+
+use SL::DB::MetaSetup::BackgroundJob;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
diff --git a/SL/DB/BackgroundJobHistory.pm b/SL/DB/BackgroundJobHistory.pm
new file mode 100644 (file)
index 0000000..f8e08f8
--- /dev/null
@@ -0,0 +1,13 @@
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::BackgroundJobHistory;
+
+use strict;
+
+use SL::DB::MetaSetup::BackgroundJobHistory;
+
+# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
+__PACKAGE__->meta->make_manager_class;
+
+1;
index 50f4b3d..3757404 100644 (file)
@@ -6,6 +6,8 @@ use SL::DB::AccTrans;
 use SL::DB::AccTransaction;
 use SL::DB::Assembly;
 use SL::DB::AuditTrail;
+use SL::DB::BackgroundJob;
+use SL::DB::BackgroundJobHistory;
 use SL::DB::BankAccount;
 use SL::DB::Bin;
 use SL::DB::Buchungsgruppe;
index 48c4863..475a7b2 100644 (file)
@@ -24,6 +24,9 @@ my %lxoffice_package_names = (
   audittrail                     => 'audit_trail',
   ar                             => 'invoice',
   ap                             => 'purchase_invoice',
+  background_jobs                => 'background_job',
+  background_job_histories       => 'background_job_history',
+  ap                             => 'purchase_invoice',
   bank_accounts                  => 'bank_account',
   buchungsgruppen                => 'buchungsgruppe',
   contacts                       => 'contact',
diff --git a/SL/DB/MetaSetup/BackgroundJob.pm b/SL/DB/MetaSetup/BackgroundJob.pm
new file mode 100644 (file)
index 0000000..c3b8212
--- /dev/null
@@ -0,0 +1,27 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::BackgroundJob;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'background_jobs',
+
+  columns => [
+    id           => { type => 'serial', not_null => 1 },
+    type         => { type => 'varchar', length => 255 },
+    package_name => { type => 'varchar', length => 255 },
+    last_run_at  => { type => 'timestamp' },
+    next_run_at  => { type => 'timestamp' },
+    data         => { type => 'text' },
+    active       => { type => 'boolean' },
+    cron_spec    => { type => 'varchar', length => 255 },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/SL/DB/MetaSetup/BackgroundJobHistory.pm b/SL/DB/MetaSetup/BackgroundJobHistory.pm
new file mode 100644 (file)
index 0000000..bd78a7d
--- /dev/null
@@ -0,0 +1,26 @@
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::BackgroundJobHistory;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->setup(
+  table   => 'background_job_histories',
+
+  columns => [
+    id           => { type => 'serial', not_null => 1 },
+    package_name => { type => 'varchar', length => 255 },
+    run_at       => { type => 'timestamp' },
+    status       => { type => 'varchar', length => 255 },
+    result       => { type => 'text' },
+    error        => { type => 'text', alias => 'error_col' },
+    data         => { type => 'text' },
+  ],
+
+  primary_key_columns => [ 'id' ],
+);
+
+1;
+;
diff --git a/sql/Pg-upgrade2/emmvee_background_jobs.sql b/sql/Pg-upgrade2/emmvee_background_jobs.sql
new file mode 100644 (file)
index 0000000..fff75c7
--- /dev/null
@@ -0,0 +1,29 @@
+-- @tag: emmvee_background_jobs
+-- @description: Tabellen für Hintergrundjobs
+-- @depends: release_2_6_1
+-- @charset: utf-8
+
+CREATE TABLE background_jobs (
+    id serial NOT NULL,
+    type character varying(255),
+    package_name character varying(255),
+    last_run_at timestamp without time zone,
+    next_run_at timestamp without time zone,
+    data text,
+    active boolean,
+    cron_spec character varying(255),
+
+    PRIMARY KEY (id)
+);
+
+CREATE TABLE background_job_histories (
+    id serial NOT NULL,
+    package_name character varying(255),
+    run_at timestamp without time zone,
+    status character varying(255),
+    result text,
+    error text,
+    data text,
+
+    PRIMARY KEY (id)
+);