use SL::DB::RequirementSpecComplexity;
use SL::DB::RequirementSpecDependency;
use SL::DB::RequirementSpecItem;
+use SL::DB::RequirementSpecOrder;
use SL::DB::RequirementSpecPredefinedText;
use SL::DB::RequirementSpecRisk;
use SL::DB::RequirementSpecStatus;
requirement_spec_complexities => 'RequirementSpecComplexity',
requirement_spec_item_dependencies => 'RequirementSpecDependency',
requirement_spec_items => 'RequirementSpecItem',
+ requirement_spec_orders => 'RequirementSpecOrder',
requirement_spec_predefined_texts => 'RequirementSpecPredefinedText',
requirement_spec_risks => 'RequirementSpecRisk',
requirement_spec_statuses => 'RequirementSpecStatus',
--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::Manager::RequirementSpecOrder;
+
+use strict;
+
+use SL::DB::Helper::Manager;
+use base qw(SL::DB::Helper::Manager);
+
+sub object_class { 'SL::DB::RequirementSpecOrder' }
+
+__PACKAGE__->make_manager_methods;
+
+1;
purchase_order_show_delete => { type => 'boolean', default => 'true' },
requirement_spec_function_block_number_format => { type => 'text', default => 'FB000', not_null => 1 },
requirement_spec_section_number_format => { type => 'text', default => 'A00', not_null => 1 },
+ requirement_spec_section_order_part_id => { type => 'integer' },
revtrans => { type => 'boolean', default => 'false' },
rfqnumber => { type => 'text' },
rmanumber => { type => 'text' },
key_columns => { currency_id => 'id' },
},
+ requirement_spec_section_order_part => {
+ class => 'SL::DB::Part',
+ key_columns => { requirement_spec_section_order_part_id => 'id' },
+ },
+
warehouse => {
class => 'SL::DB::Warehouse',
key_columns => { warehouse_id => 'id' },
item_type => { type => 'text', not_null => 1 },
itime => { type => 'timestamp', default => 'now()', not_null => 1 },
mtime => { type => 'timestamp' },
+ order_part_id => { type => 'integer' },
parent_id => { type => 'integer' },
position => { type => 'integer', not_null => 1 },
requirement_spec_id => { type => 'integer', not_null => 1 },
key_columns => { complexity_id => 'id' },
},
+ order_part => {
+ class => 'SL::DB::Part',
+ key_columns => { order_part_id => 'id' },
+ },
+
parent => {
class => 'SL::DB::RequirementSpecItem',
key_columns => { parent_id => 'id' },
--- /dev/null
+# This file has been auto-generated. Do not modify it; it will be overwritten
+# by rose_auto_create_model.pl automatically.
+package SL::DB::RequirementSpecOrder;
+
+use strict;
+
+use base qw(SL::DB::Object);
+
+__PACKAGE__->meta->table('requirement_spec_orders');
+
+__PACKAGE__->meta->columns(
+ id => { type => 'serial', not_null => 1 },
+ itime => { type => 'timestamp', default => 'now()', not_null => 1 },
+ mtime => { type => 'timestamp', default => 'now()', not_null => 1 },
+ order_id => { type => 'integer', not_null => 1 },
+ requirement_spec_id => { type => 'integer', not_null => 1 },
+ version_id => { type => 'integer' },
+);
+
+__PACKAGE__->meta->primary_key_columns([ 'id' ]);
+
+__PACKAGE__->meta->unique_keys([ 'requirement_spec_id', 'order_id' ]);
+
+__PACKAGE__->meta->allow_inline_column_values(1);
+
+__PACKAGE__->meta->foreign_keys(
+ order => {
+ class => 'SL::DB::Order',
+ key_columns => { order_id => 'id' },
+ },
+
+ requirement_spec => {
+ class => 'SL::DB::RequirementSpec',
+ key_columns => { requirement_spec_id => 'id' },
+ },
+
+ version => {
+ class => 'SL::DB::RequirementSpecVersion',
+ key_columns => { version_id => 'id' },
+ },
+);
+
+1;
+;
id => { type => 'serial', not_null => 1 },
itime => { type => 'timestamp', default => 'now()' },
mtime => { type => 'timestamp' },
- order_date => { type => 'date' },
- order_id => { type => 'integer' },
- order_number => { type => 'text' },
version_number => { type => 'integer' },
);
__PACKAGE__->meta->allow_inline_column_values(1);
-__PACKAGE__->meta->foreign_keys(
- order => {
- class => 'SL::DB::Order',
- key_columns => { order_id => 'id' },
- },
-);
-
1;
;
--- /dev/null
+# This file has been auto-generated only because it didn't exist.
+# Feel free to modify it at will; it will not be overwritten automatically.
+
+package SL::DB::RequirementSpecOrder;
+
+use strict;
+
+use SL::DB::MetaSetup::RequirementSpecOrder;
+use SL::DB::Manager::RequirementSpecOrder;
+
+__PACKAGE__->meta->initialize;
+
+1;
--- /dev/null
+-- @tag: requirement_specs_orders
+-- @description: requirement_specs_orders
+-- @depends: requirement_specs requirement_specs_section_templates
+
+-- Remove unneeded columns
+ALTER TABLE requirement_spec_versions DROP CONSTRAINT requirement_spec_versions_order_id_fkey;
+
+ALTER TABLE requirement_spec_versions DROP COLUMN order_date;
+ALTER TABLE requirement_spec_versions DROP COLUMN order_number;
+ALTER TABLE requirement_spec_versions DROP COLUMN order_id;
+
+-- Add new columns to existing tables
+ALTER TABLE requirement_spec_items ADD COLUMN order_part_id INTEGER;
+ALTER TABLE requirement_spec_items ADD FOREIGN KEY (order_part_id) REFERENCES parts (id) ON DELETE SET NULL;
+
+ALTER TABLE defaults ADD COLUMN requirement_spec_section_order_part_id INTEGER;
+ALTER TABLE defaults ADD FOREIGN KEY (requirement_spec_section_order_part_id) REFERENCES parts (id) ON DELETE SET NULL;
+
+-- Create new tables
+CREATE TABLE requirement_spec_orders (
+ id SERIAL,
+ requirement_spec_id INTEGER NOT NULL,
+ order_id INTEGER NOT NULL,
+ version_id INTEGER,
+ itime TIMESTAMP NOT NULL DEFAULT now(),
+ mtime TIMESTAMP NOT NULL DEFAULT now(),
+
+ PRIMARY KEY (id),
+ FOREIGN KEY (requirement_spec_id) REFERENCES requirement_specs (id) ON DELETE CASCADE,
+ FOREIGN KEY (order_id) REFERENCES oe (id) ON DELETE CASCADE,
+ FOREIGN KEY (version_id) REFERENCES requirement_spec_versions (id) ON DELETE SET NULL,
+ CONSTRAINT requirement_spec_id_order_id_unique UNIQUE (requirement_spec_id, order_id)
+);
+
+CREATE TRIGGER mtime_requirement_spec_orders BEFORE UPDATE ON requirement_spec_orders FOR EACH ROW EXECUTE PROCEDURE set_mtime();