File: 19_dbmigrate.sql

package info (click to toggle)
kraft 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,112 kB
  • sloc: cpp: 28,535; sql: 1,248; perl: 396; xml: 330; python: 101; sh: 92; makefile: 10
file content (36 lines) | stat: -rw-r--r-- 1,368 bytes parent folder | download | duplicates (5)
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
# message Create new document type delivery note
INSERT INTO DocTypes (name) VALUES ('Lieferschein');
SET @lsId := LAST_INSERT_ID();
INSERT INTO attributes (hostObject, hostId, name, valueIsList) VALUES ('DocType', @lsId, 'HidePrices', 1);

INSERT INTO DocTypes (name) VALUES ('Delivery Receipt');
SET @nodId := LAST_INSERT_ID();
INSERT INTO attributes (hostObject, hostId, name, valueIsList) VALUES ('DocType', @nodId, 'HidePrices', 1);

# message Add more document relation settings
# Lieferschein follows Angebot
SELECT @item := docTypeID FROM DocTypes WHERE name="Angebot";
# mayfail
INSERT INTO DocTypeRelations VALUES( @item, @lsId, 10 );

# Rechnung follows Lieferschein
SELECT @follower := docTypeID FROM DocTypes WHERE name="Rechnung";
# mayfail
INSERT INTO DocTypeRelations VALUES( @lsId, @follower, 11 );

# Delivery Receipt follows Offer
SELECT @item := docTypeID FROM DocTypes WHERE name="Offer";
# mayfail
INSERT INTO DocTypeRelations VALUES( @item, @nodId, 12 );

# Invoice follows Delivery Receipt
SELECT @follower := docTypeID FROM DocTypes WHERE name="Invoice";
# mayfail
INSERT INTO DocTypeRelations VALUES( @nodId, @follower, 13 );


# enhance the clientID col in document because the ids can be larger.
ALTER TABLE document CHANGE COLUMN clientID clientID VARCHAR(255);
ALTER TABLE archdoc CHANGE COLUMN clientUid clientUid VARCHAR(255);

# Done.