Makemodel make mit Lieferant per Fremdschlüssel verknüpft
authorG. Richardson <information@kivitendo-premium.de>
Sun, 7 Aug 2016 20:57:44 +0000 (22:57 +0200)
committerG. Richardson <information@kivitendo-premium.de>
Tue, 22 Nov 2016 13:42:49 +0000 (14:42 +0100)
SL/DB/MetaSetup/MakeModel.pm
sql/Pg-upgrade2/makemodel_add_vendor_foreign_key.sql [new file with mode: 0644]

index 6ec58a2..e13461a 100644 (file)
@@ -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 (file)
index 0000000..85d60ce
--- /dev/null
@@ -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);