Revision 26d55f63
SL/DB/File.pm | ||
---|---|---|
16 | 16 |
}, |
17 | 17 |
); |
18 | 18 |
|
19 |
__PACKAGE__->meta->add_relationship( |
|
20 |
file_version => { |
|
21 |
type => 'one to many', |
|
22 |
class => 'SL::DB::FileVersion', |
|
23 |
column_map => { id => 'file_id' }, |
|
24 |
}, |
|
25 |
); |
|
26 |
|
|
27 |
|
|
19 | 28 |
__PACKAGE__->meta->initialize; |
20 | 29 |
|
21 | 30 |
|
SL/DB/FileVersion.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::FileVersion; |
|
5 |
|
|
6 |
use strict; |
|
7 |
|
|
8 |
use SL::DB::MetaSetup::FileVersion; |
|
9 |
use SL::DB::Manager::FileVersion; |
|
10 |
|
|
11 |
__PACKAGE__->meta->initialize; |
|
12 |
|
|
13 |
1; |
SL/DB/Helper/Mappings.pm | ||
---|---|---|
145 | 145 |
employee_project_invoices => 'EmployeeProjectInvoices', |
146 | 146 |
exchangerate => 'exchangerate', |
147 | 147 |
files => 'file', |
148 |
file_versions => 'file_version', |
|
148 | 149 |
file_full_texts => 'file_full_text', |
149 | 150 |
finanzamt => 'finanzamt', |
150 | 151 |
follow_up_access => 'follow_up_access', |
SL/DB/Manager/FileVersion.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::FileVersion; |
|
5 |
|
|
6 |
use strict; |
|
7 |
|
|
8 |
use parent qw(SL::DB::Helper::Manager); |
|
9 |
|
|
10 |
sub object_class { 'SL::DB::FileVersion' } |
|
11 |
|
|
12 |
__PACKAGE__->make_manager_methods; |
|
13 |
|
|
14 |
1; |
SL/DB/MetaSetup/FileVersion.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::FileVersion; |
|
4 |
|
|
5 |
use strict; |
|
6 |
|
|
7 |
use parent qw(SL::DB::Object); |
|
8 |
|
|
9 |
__PACKAGE__->meta->table('file_versions'); |
|
10 |
|
|
11 |
__PACKAGE__->meta->columns( |
|
12 |
backend => { type => 'text', not_null => 1 }, |
|
13 |
doc_path => { type => 'text', not_null => 1 }, |
|
14 |
file_id => { type => 'integer', not_null => 1 }, |
|
15 |
file_location => { type => 'text', not_null => 1 }, |
|
16 |
guid => { type => 'text' }, |
|
17 |
itime => { type => 'timestamp', default => 'now()', not_null => 1 }, |
|
18 |
mtime => { type => 'timestamp' }, |
|
19 |
version => { type => 'integer', not_null => 1 }, |
|
20 |
); |
|
21 |
|
|
22 |
__PACKAGE__->meta->primary_key_columns([ 'file_id', 'version' ]); |
|
23 |
|
|
24 |
__PACKAGE__->meta->allow_inline_column_values(1); |
|
25 |
|
|
26 |
__PACKAGE__->meta->foreign_keys( |
|
27 |
file => { |
|
28 |
class => 'SL::DB::File', |
|
29 |
key_columns => { file_id => 'id' }, |
|
30 |
}, |
|
31 |
); |
|
32 |
|
|
33 |
1; |
|
34 |
; |
sql/Pg-upgrade2/file_version.sql | ||
---|---|---|
1 |
-- @tag: file_version |
|
2 |
-- @description: Tabelle für Dokumentenversion |
|
3 |
-- @depends: release_3_6_0 |
|
4 |
|
|
5 |
CREATE TABLE IF NOT EXISTS file_versions ( |
|
6 |
guid TEXT, |
|
7 |
file_id INTEGER NOT NULL REFERENCES files(id) ON DELETE CASCADE, |
|
8 |
version INTEGER NOT NULL, |
|
9 |
file_location TEXT NOT NULL, |
|
10 |
doc_path TEXT NOT NULL, |
|
11 |
backend TEXT NOT NULL, |
|
12 |
itime TIMESTAMP NOT NULL DEFAULT now(), |
|
13 |
mtime TIMESTAMP, |
|
14 |
PRIMARY KEY (file_id, version) |
|
15 |
); |
|
16 |
|
|
17 |
CREATE TRIGGER mtime_file_version BEFORE UPDATE ON file_versions FOR EACH ROW EXECUTE PROCEDURE set_mtime(); |
Auch abrufbar als: Unified diff
Neue Datenbank-Tabelle file_versions