Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 687a09d8

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 687a09d87aee39ab016bf2ec410da006f5044bc4
  • Vorgänger 57d97e2b
  • Nachfolger fb692c5f

Pflichtenheft-Angebot/Auftrag: DB-Schema & Models

Unterschiede anzeigen:

SL/DB/Helper/ALL.pm
81 81
use SL::DB::RequirementSpecComplexity;
82 82
use SL::DB::RequirementSpecDependency;
83 83
use SL::DB::RequirementSpecItem;
84
use SL::DB::RequirementSpecOrder;
84 85
use SL::DB::RequirementSpecPredefinedText;
85 86
use SL::DB::RequirementSpecRisk;
86 87
use SL::DB::RequirementSpecStatus;
SL/DB/Helper/Mappings.pm
161 161
  requirement_spec_complexities        => 'RequirementSpecComplexity',
162 162
  requirement_spec_item_dependencies   => 'RequirementSpecDependency',
163 163
  requirement_spec_items               => 'RequirementSpecItem',
164
  requirement_spec_orders              => 'RequirementSpecOrder',
164 165
  requirement_spec_predefined_texts    => 'RequirementSpecPredefinedText',
165 166
  requirement_spec_risks               => 'RequirementSpecRisk',
166 167
  requirement_spec_statuses            => 'RequirementSpecStatus',
SL/DB/Manager/RequirementSpecOrder.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::Manager::RequirementSpecOrder;
5

  
6
use strict;
7

  
8
use SL::DB::Helper::Manager;
9
use base qw(SL::DB::Helper::Manager);
10

  
11
sub object_class { 'SL::DB::RequirementSpecOrder' }
12

  
13
__PACKAGE__->make_manager_methods;
14

  
15
1;
SL/DB/MetaSetup/Default.pm
69 69
  purchase_order_show_delete                    => { type => 'boolean', default => 'true' },
70 70
  requirement_spec_function_block_number_format => { type => 'text', default => 'FB000', not_null => 1 },
71 71
  requirement_spec_section_number_format        => { type => 'text', default => 'A00', not_null => 1 },
72
  requirement_spec_section_order_part_id        => { type => 'integer' },
72 73
  revtrans                                      => { type => 'boolean', default => 'false' },
73 74
  rfqnumber                                     => { type => 'text' },
74 75
  rmanumber                                     => { type => 'text' },
......
117 118
    key_columns => { currency_id => 'id' },
118 119
  },
119 120

  
121
  requirement_spec_section_order_part => {
122
    class       => 'SL::DB::Part',
123
    key_columns => { requirement_spec_section_order_part_id => 'id' },
124
  },
125

  
120 126
  warehouse => {
121 127
    class       => 'SL::DB::Warehouse',
122 128
    key_columns => { warehouse_id => 'id' },
SL/DB/MetaSetup/RequirementSpecItem.pm
19 19
  item_type            => { type => 'text', not_null => 1 },
20 20
  itime                => { type => 'timestamp', default => 'now()', not_null => 1 },
21 21
  mtime                => { type => 'timestamp' },
22
  order_part_id        => { type => 'integer' },
22 23
  parent_id            => { type => 'integer' },
23 24
  position             => { type => 'integer', not_null => 1 },
24 25
  requirement_spec_id  => { type => 'integer', not_null => 1 },
......
42 43
    key_columns => { complexity_id => 'id' },
43 44
  },
44 45

  
46
  order_part => {
47
    class       => 'SL::DB::Part',
48
    key_columns => { order_part_id => 'id' },
49
  },
50

  
45 51
  parent => {
46 52
    class       => 'SL::DB::RequirementSpecItem',
47 53
    key_columns => { parent_id => 'id' },
SL/DB/MetaSetup/RequirementSpecOrder.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::RequirementSpecOrder;
4

  
5
use strict;
6

  
7
use base qw(SL::DB::Object);
8

  
9
__PACKAGE__->meta->table('requirement_spec_orders');
10

  
11
__PACKAGE__->meta->columns(
12
  id                  => { type => 'serial', not_null => 1 },
13
  itime               => { type => 'timestamp', default => 'now()', not_null => 1 },
14
  mtime               => { type => 'timestamp', default => 'now()', not_null => 1 },
15
  order_id            => { type => 'integer', not_null => 1 },
16
  requirement_spec_id => { type => 'integer', not_null => 1 },
17
  version_id          => { type => 'integer' },
18
);
19

  
20
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
21

  
22
__PACKAGE__->meta->unique_keys([ 'requirement_spec_id', 'order_id' ]);
23

  
24
__PACKAGE__->meta->allow_inline_column_values(1);
25

  
26
__PACKAGE__->meta->foreign_keys(
27
  order => {
28
    class       => 'SL::DB::Order',
29
    key_columns => { order_id => 'id' },
30
  },
31

  
32
  requirement_spec => {
33
    class       => 'SL::DB::RequirementSpec',
34
    key_columns => { requirement_spec_id => 'id' },
35
  },
36

  
37
  version => {
38
    class       => 'SL::DB::RequirementSpecVersion',
39
    key_columns => { version_id => 'id' },
40
  },
41
);
42

  
43
1;
44
;
SL/DB/MetaSetup/RequirementSpecVersion.pm
14 14
  id             => { type => 'serial', not_null => 1 },
15 15
  itime          => { type => 'timestamp', default => 'now()' },
16 16
  mtime          => { type => 'timestamp' },
17
  order_date     => { type => 'date' },
18
  order_id       => { type => 'integer' },
19
  order_number   => { type => 'text' },
20 17
  version_number => { type => 'integer' },
21 18
);
22 19

  
......
24 21

  
25 22
__PACKAGE__->meta->allow_inline_column_values(1);
26 23

  
27
__PACKAGE__->meta->foreign_keys(
28
  order => {
29
    class       => 'SL::DB::Order',
30
    key_columns => { order_id => 'id' },
31
  },
32
);
33

  
34 24
1;
35 25
;
SL/DB/RequirementSpecOrder.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4
package SL::DB::RequirementSpecOrder;
5

  
6
use strict;
7

  
8
use SL::DB::MetaSetup::RequirementSpecOrder;
9
use SL::DB::Manager::RequirementSpecOrder;
10

  
11
__PACKAGE__->meta->initialize;
12

  
13
1;
sql/Pg-upgrade2/requirement_specs_orders.sql
1
-- @tag: requirement_specs_orders
2
-- @description: requirement_specs_orders
3
-- @depends: requirement_specs requirement_specs_section_templates
4

  
5
-- Remove unneeded columns
6
ALTER TABLE requirement_spec_versions DROP CONSTRAINT requirement_spec_versions_order_id_fkey;
7

  
8
ALTER TABLE requirement_spec_versions DROP COLUMN order_date;
9
ALTER TABLE requirement_spec_versions DROP COLUMN order_number;
10
ALTER TABLE requirement_spec_versions DROP COLUMN order_id;
11

  
12
-- Add new columns to existing tables
13
ALTER TABLE requirement_spec_items ADD COLUMN order_part_id INTEGER;
14
ALTER TABLE requirement_spec_items ADD FOREIGN KEY (order_part_id) REFERENCES parts (id) ON DELETE SET NULL;
15

  
16
ALTER TABLE defaults ADD COLUMN requirement_spec_section_order_part_id INTEGER;
17
ALTER TABLE defaults ADD FOREIGN KEY (requirement_spec_section_order_part_id) REFERENCES parts (id) ON DELETE SET NULL;
18

  
19
-- Create new tables
20
CREATE TABLE requirement_spec_orders (
21
  id                  SERIAL,
22
  requirement_spec_id INTEGER NOT NULL,
23
  order_id            INTEGER NOT NULL,
24
  version_id          INTEGER,
25
  itime               TIMESTAMP NOT NULL DEFAULT now(),
26
  mtime               TIMESTAMP NOT NULL DEFAULT now(),
27

  
28
  PRIMARY KEY (id),
29
  FOREIGN KEY (requirement_spec_id) REFERENCES requirement_specs         (id) ON DELETE CASCADE,
30
  FOREIGN KEY (order_id)            REFERENCES oe                        (id) ON DELETE CASCADE,
31
  FOREIGN KEY (version_id)          REFERENCES requirement_spec_versions (id) ON DELETE SET NULL,
32
  CONSTRAINT requirement_spec_id_order_id_unique UNIQUE (requirement_spec_id, order_id)
33
);
34

  
35
CREATE TRIGGER mtime_requirement_spec_orders BEFORE UPDATE ON requirement_spec_orders FOR EACH ROW EXECUTE PROCEDURE set_mtime();

Auch abrufbar als: Unified diff