-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_setup.sql
58 lines (52 loc) · 2.04 KB
/
test_setup.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
set search_path TO inventory, public;
insert into account_type (account_type_id) values
('supplied'),
('received'),
('stocked'),
('commited'),
('shipped')
;
insert into location_type (location_type_id) values
('supplier'),
('receiving'),
('stock'),
('picking'),
('assembly'),
('package')
;
insert into unit_of_measure (name, incremental, divisible, combinable) values
('item', 1, false, false)
returning unit_of_measure_id as item_uom
\gset
insert into unit_of_measure (name, incremental, divisible, combinable) values
('yards', 0.25, true, false)
returning unit_of_measure_id as yards_uom
\gset
insert into item (sku, unit_of_measure_id) values
('THING1', :item_uom),
('WIDGET2', :yards_uom);
insert into location
(location_id , location_type_id , location_lpn)
values
(1 , 'supplier' , 'megacorp' ) ,
(2 , 'receiving' , 'Shipper.54321' ) ,
(3 , 'stock' , 'A-B-C-D' ) ,
(4 , 'package' , 'Shipper.12345' ),
(5 , 'receiving' , 'Shipper.98765' )
;
insert into account
(account_id , location_id , account_type_id , sku , quantity, measure, unit_of_measure_id)
values
(1 , 1 , 'supplied' , 'THING1' , 0, 0, :item_uom),
(2 , 2 , 'received' , 'THING1' , 0, 0, :item_uom),
(3 , 3 , 'stocked' , 'THING1' , 0, 0, :item_uom),
(4 , 3 , 'commited' , 'THING1' , 0, 0, :item_uom),
(5 , 4 , 'commited' , 'THING1' , 0, 0, :item_uom),
(6 , 4 , 'shipped' , 'THING1' , 0, 0, :item_uom),
(7 , 1 , 'supplied' , 'WIDGET2' , 0, 0, :yards_uom),
(8 , 2 , 'received' , 'WIDGET2' , 0, 0, :yards_uom),
(9 , 3 , 'stocked' , 'WIDGET2' , 0, 0, :yards_uom),
(10 , 3 , 'commited' , 'WIDGET2' , 0, 0, :yards_uom),
(11 , 4 , 'commited' , 'WIDGET2' , 0, 0, :yards_uom),
(12 , 4 , 'shipped' , 'WIDGET2' , 0, 0, :yards_uom)
;