From 36922218f4d6e25152d06d6fa44ed94360e284ab Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Sun, 7 Aug 2016 22:57:44 +0200 Subject: [PATCH] =?utf8?q?Makemodel=20make=20mit=20Lieferant=20per=20Fremd?= =?utf8?q?schl=C3=BCssel=20verkn=C3=BCpft?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/MetaSetup/MakeModel.pm | 7 +++++++ sql/Pg-upgrade2/makemodel_add_vendor_foreign_key.sql | 6 ++++++ 2 files changed, 13 insertions(+) create mode 100644 sql/Pg-upgrade2/makemodel_add_vendor_foreign_key.sql diff --git a/SL/DB/MetaSetup/MakeModel.pm b/SL/DB/MetaSetup/MakeModel.pm index 6ec58a2f0..e13461a6d 100644 --- a/SL/DB/MetaSetup/MakeModel.pm +++ b/SL/DB/MetaSetup/MakeModel.pm @@ -24,5 +24,12 @@ __PACKAGE__->meta->primary_key_columns([ 'id' ]); __PACKAGE__->meta->allow_inline_column_values(1); +__PACKAGE__->meta->foreign_keys( + vendor => { + class => 'SL::DB::Vendor', + key_columns => { make => 'id' }, + }, +); + 1; ; diff --git a/sql/Pg-upgrade2/makemodel_add_vendor_foreign_key.sql b/sql/Pg-upgrade2/makemodel_add_vendor_foreign_key.sql new file mode 100644 index 000000000..85d60ceff --- /dev/null +++ b/sql/Pg-upgrade2/makemodel_add_vendor_foreign_key.sql @@ -0,0 +1,6 @@ +-- @tag: makemodel_add_vendor_foreign_key +-- @description: Makemodel make mit Lieferant verknüpft +-- @depends: release_3_4_1 +-- @ignore: 0 + +ALTER TABLE makemodel ADD FOREIGN KEY (make) REFERENCES vendor(id); -- 2.20.1