From 68525bb179b59bf35362e7a9e482bc17ebfd32c8 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 11 Nov 2010 17:49:46 +0100 Subject: [PATCH] =?utf8?q?acc=5Ftrans=20enth=C3=A4lt=20bereits=20eine=20Pr?= =?utf8?q?im=C3=A4rschl=C3=BCsselspalte?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Der war nur bisher noch nicht als solcher markiert. Hinzu kommt, dass RDBO acc_trans_id beim Anlegen von Einträgen in acc_trans nicht automatisch befüllt; genauer: explizit auf NULL setzt. Das wiederum verwirrt andere Bereiche von Lx-Office. Weiterhin gibt es einige Queries, die nicht darauf vorbereitet sind, dass acc_trans plötzlich eine Spalte namens "id" enthält (z.B. Reporting). --- SL/DB/MetaSetup/AccTransaction.pm | 5 ++--- sql/Pg-upgrade2/schema_normalization_3.sql | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 sql/Pg-upgrade2/schema_normalization_3.sql diff --git a/SL/DB/MetaSetup/AccTransaction.pm b/SL/DB/MetaSetup/AccTransaction.pm index 9f6e6b45e..649b4647f 100644 --- a/SL/DB/MetaSetup/AccTransaction.pm +++ b/SL/DB/MetaSetup/AccTransaction.pm @@ -10,7 +10,7 @@ __PACKAGE__->meta->setup( table => 'acc_trans', columns => [ - acc_trans_id => { type => 'bigint', sequence => 'acc_trans_id_seq' }, + acc_trans_id => { type => 'bigint', not_null => 1, sequence => 'acc_trans_id_seq' }, trans_id => { type => 'integer', not_null => 1 }, chart_id => { type => 'integer', not_null => 1 }, amount => { type => 'numeric', precision => 5, scale => 15 }, @@ -26,10 +26,9 @@ __PACKAGE__->meta->setup( taxkey => { type => 'integer' }, itime => { type => 'timestamp', default => 'now()' }, mtime => { type => 'timestamp' }, - id => { type => 'integer', not_null => 1, sequence => 'acc_trans_id_seq1' }, ], - primary_key_columns => [ 'id' ], + primary_key_columns => [ 'acc_trans_id' ], allow_inline_column_values => 1, diff --git a/sql/Pg-upgrade2/schema_normalization_3.sql b/sql/Pg-upgrade2/schema_normalization_3.sql new file mode 100644 index 000000000..528fc8f1b --- /dev/null +++ b/sql/Pg-upgrade2/schema_normalization_3.sql @@ -0,0 +1,6 @@ +-- @tag: schema_normalization_3 +-- @description: Datenbankschema Normalisierungen Teil 3 +-- @depends: schema_normalization_2 + +ALTER TABLE acc_trans DROP COLUMN id; +ALTER TABLE acc_trans ADD PRIMARY KEY (acc_trans_id); -- 2.20.1