From ea8bf9733e420ae3c74fdfc2765e9f2aa9da2815 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Sun, 7 Aug 2016 22:40:09 +0200 Subject: [PATCH] Tabelle assembly bekommt eine Positionsspalte bisher wurde nach oid sortiert. --- SL/DB/MetaSetup/Assembly.pm | 1 + SL/DB/Part.pm | 1 + sql/Pg-upgrade2/assembly_position.sql | 6 ++++++ 3 files changed, 8 insertions(+) create mode 100644 sql/Pg-upgrade2/assembly_position.sql diff --git a/SL/DB/MetaSetup/Assembly.pm b/SL/DB/MetaSetup/Assembly.pm index 87ffae6e3..47eb3cf3d 100644 --- a/SL/DB/MetaSetup/Assembly.pm +++ b/SL/DB/MetaSetup/Assembly.pm @@ -15,6 +15,7 @@ __PACKAGE__->meta->columns( itime => { type => 'timestamp', default => 'now()' }, mtime => { type => 'timestamp' }, parts_id => { type => 'integer', not_null => 1 }, + position => { type => 'integer' }, qty => { type => 'float', scale => 4 }, ); diff --git a/SL/DB/Part.pm b/SL/DB/Part.pm index 09fdc0d9e..e095506f1 100644 --- a/SL/DB/Part.pm +++ b/SL/DB/Part.pm @@ -21,6 +21,7 @@ __PACKAGE__->meta->add_relationships( assemblies => { type => 'one to many', class => 'SL::DB::Assembly', + manager_args => { sort_by => 'position, oid' }, column_map => { id => 'id' }, }, prices => { diff --git a/sql/Pg-upgrade2/assembly_position.sql b/sql/Pg-upgrade2/assembly_position.sql new file mode 100644 index 000000000..b96a0d66f --- /dev/null +++ b/sql/Pg-upgrade2/assembly_position.sql @@ -0,0 +1,6 @@ +-- @tag: assembly_position +-- @description: Erzeugniselemente (assembly) erhalten eine Position +-- @depends: release_3_4_1 +-- @ignore: 0 + +ALTER TABLE assembly ADD COLUMN position INTEGER; -- 2.20.1