id => { type => 'integer' },
itime => { type => 'timestamp', default => 'now()' },
mtime => { type => 'timestamp' },
- parts_id => { type => 'integer' },
+ parts_id => { type => 'integer', not_null => 1 },
qty => { type => 'float', scale => 4 },
);
__PACKAGE__->meta->allow_inline_column_values(1);
+__PACKAGE__->meta->foreign_keys(
+ parts => {
+ class => 'SL::DB::Part',
+ key_columns => { parts_id => 'id' },
+ },
+);
+
1;
;
--- /dev/null
+-- @tag: assembly_parts_foreign_key
+-- @description: Erzeugniselement (assembly) erhält Fremdschlüssel auf parts + NOT NULL
+-- @depends: release_3_4_1
+-- @ignore: 0
+
+ALTER TABLE assembly ADD FOREIGN KEY (parts_id) REFERENCES parts(id);
+ALTER TABLE assembly ALTER COLUMN parts_id SET NOT NULL;