Revision fac0e68e
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
sql/Pg-upgrade2/employee_no_limits.sql | ||
---|---|---|
1 |
-- @tag: employee_no_limits |
|
2 |
-- @description: Keine Längenbeschränkung für Spalten in der Tabelle employee. |
|
3 |
-- @depends: release_2_4_1 |
|
4 |
ALTER TABLE employee ADD COLUMN tmp_name text; |
|
5 |
ALTER TABLE employee ADD COLUMN tmp_addr1 text; |
|
6 |
ALTER TABLE employee ADD COLUMN tmp_addr2 text; |
|
7 |
ALTER TABLE employee ADD COLUMN tmp_addr3 text; |
|
8 |
ALTER TABLE employee ADD COLUMN tmp_addr4 text; |
|
9 |
ALTER TABLE employee ADD COLUMN tmp_homephone text; |
|
10 |
ALTER TABLE employee ADD COLUMN tmp_workphone text; |
|
11 |
|
|
12 |
UPDATE employee SET tmp_name = name, tmp_addr1 = addr1, tmp_addr2 = addr2, tmp_addr3 = addr3, tmp_addr4 = addr4, tmp_homephone = homephone, tmp_workphone = workphone; |
|
13 |
|
|
14 |
ALTER TABLE employee DROP COLUMN name; |
|
15 |
ALTER TABLE employee RENAME tmp_name TO name; |
|
16 |
ALTER TABLE employee DROP COLUMN addr1; |
|
17 |
ALTER TABLE employee RENAME tmp_addr1 TO addr1; |
|
18 |
ALTER TABLE employee DROP COLUMN addr2; |
|
19 |
ALTER TABLE employee RENAME tmp_addr2 TO addr2; |
|
20 |
ALTER TABLE employee DROP COLUMN addr3; |
|
21 |
ALTER TABLE employee RENAME tmp_addr3 TO addr3; |
|
22 |
ALTER TABLE employee DROP COLUMN addr4; |
|
23 |
ALTER TABLE employee RENAME tmp_addr4 TO addr4; |
|
24 |
ALTER TABLE employee DROP COLUMN homephone; |
|
25 |
ALTER TABLE employee RENAME tmp_homephone TO homephone; |
|
26 |
ALTER TABLE employee DROP COLUMN workphone; |
|
27 |
ALTER TABLE employee RENAME tmp_workphone TO workphone; |
|
28 |
|
|
29 |
CREATE INDEX employee_name_key ON employee ( name ); |
Auch abrufbar als: Unified diff
In der Tabelle employee sollten die Spalten keine künstliche Längenbeschränkung haben.