Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 105c3f60

Von Jan Büren vor 8 Monaten hinzugefügt

  • ID 105c3f60b7038c79696d18eeb61b4ea60b2112a5
  • Vorgänger a454ccd7
  • Nachfolger 72e4f6a7

FileVersion: Migration der bestehende DMS Dokumente in Hilfstabelle

Unterschiede anzeigen:

sql/Pg-upgrade2/add_file_version.pl
1
# @tag: add_file_version
2
# @description: Versionen für files in extra Tabelle erzeugen
3
# @depends: release_3_6_0 file_version
4
package SL::DBUpgrade2::add_file_version;
5

  
6
use strict;
7
use utf8;
8

  
9
use SL::DB::File;
10

  
11
use UUID::Tiny ':std';
12

  
13
use parent qw(SL::DBUpgrade2::Base);
14

  
15
sub run {
16
  my ($self) = @_;
17

  
18
  my $doc_path = $::lx_office_conf{paths}->{document_path};
19

  
20
  my $all_dbfiles = SL::DB::Manager::File->get_all;
21
  my $dbfile;
22
  foreach $dbfile (@$all_dbfiles) {
23
    my @versions = SL::File->get_all_versions(dbfile => $dbfile);
24

  
25
    foreach my $version (@versions) {
26
      my $tofile = $version->get_file();
27
      my $rel_file = $tofile;
28
      $rel_file    =~ s/$doc_path//;
29

  
30
      my $fv = SL::DB::FileVersion->new(
31
                            file_id       => $dbfile->id,
32
                            version       => $version->version,
33
                            file_location => $rel_file,
34
                            doc_path      => $doc_path,
35
                            backend       => $dbfile->backend,
36
                            guid          => create_uuid_as_string(UUID_V4),
37
                          )->save;
38
    }
39
  }
40

  
41
  return 1;
42
}
43

  
44
1;

Auch abrufbar als: Unified diff