Revision 36ab63d0
Von Tamino Steinert vor 8 Monaten hinzugefügt
SL/DB/MetaSetup/File.pm | ||
---|---|---|
9 | 9 |
__PACKAGE__->meta->table('files'); |
10 | 10 |
|
11 | 11 |
__PACKAGE__->meta->columns( |
12 |
backend => { type => 'text' },
|
|
12 |
backend => { type => 'enum', check_in => [ 'Filesystem', 'Webdav' ], db_type => 'files_backends', not_null => 1 },
|
|
13 | 13 |
backend_data => { type => 'text' }, |
14 | 14 |
description => { type => 'text' }, |
15 | 15 |
file_name => { type => 'text', not_null => 1 }, |
sql/Pg-upgrade2/change_file_backend_to_enum.sql | ||
---|---|---|
1 |
-- @tag: change_file_backend_to_enum |
|
2 |
-- @description: Backend für Dateien auf Type Enum setzen |
|
3 |
-- @depends: release_3_6_0 |
|
4 |
|
|
5 |
CREATE TYPE files_backends AS ENUM ('Filesystem', 'Webdav'); |
|
6 |
|
|
7 |
ALTER TABLE files ADD COLUMN backend_new files_backends; |
|
8 |
UPDATE files SET backend_new = 'Filesystem' WHERE backend = 'Filesystem'; |
|
9 |
UPDATE files SET backend_new = 'Webdav' WHERE backend = 'Webdav'; |
|
10 |
ALTER TABLE files ALTER COLUMN backend_new SET NOT NULL; |
|
11 |
ALTER TABLE files DROP COLUMN backend; |
|
12 |
ALTER TABLE files RENAME COLUMN backend_new TO backend; |
Auch abrufbar als: Unified diff
S:D:File: Backend auf Type Enum setzen