Changeset 881


Ignore:
Timestamp:
12/27/11 18:14:32 (13 years ago)
Author:
nanardon
Message:
  • add tools to update database schema
  • install sql file and attributes data with software
Location:
LATMOS-Accounts
Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/MANIFEST

    r867 r881  
    3232bin/la-sql-regatt 
    3333bin/la-sql-sanity 
     34bin/la-sql-upgrade.in 
    3435bin/la-sync 
    3536bin/la-sync-list 
  • LATMOS-Accounts/Makefile.PL

    r877 r881  
    5757        bin/la-sql-regatt 
    5858        bin/la-sql-loadatt 
     59        bin/la-sql-upgrade 
    5960        ) ], 
    6061        macro => { 
     
    6263            DESTINSTALLMAN5DIR  => '$(DESTDIR)$(INSTALLMAN5DIR)', 
    6364            INST_MAN5DIR        => 'blib/man5', 
    64             DESTRPMDIR          => '$(shell pwd)' 
     65            DESTRPMDIR          => '$(shell pwd)', 
     66            DATADIR             => '/usr/share/latmos-accounts', 
     67            DESTDATADIR         => '$(DESTDIR)$(DATADIR)', 
    6568        }, 
    6669        MAN1PODS        => { 
     
    8386    <<EOF; 
    8487#.PHONY .= svnmanifest 
     88 
     89bin/la-sql-upgrade: bin/la-sql-upgrade.in 
     90\tcat \$< \| sed 's:\@DATADIR\@:\$(DATADIR):' > \$@ 
     91\tchmod +x \$@ 
    8592 
    8693svnmanifest: 
     
    134141    my $section = $self->SUPER::install(); 
    135142 
    136     $section =~ s/(^install ::.*)/$1 install_config install_templates/m; 
     143    $section =~ s/(^install ::.*)/$1 install_config install_templates install_data/m; 
    137144    $section =~ s/\$\(INST_BIN\) \$\(DESTINSTALL(\w*)BIN\)/$& \$(INST_MAN5DIR) \$(DESTINSTALLMAN5DIR)/g; 
    138145 
     
    147154 
    148155install_templates :: 
    149         install -d $(DESTDIR)/usr/share/latmos-accounts/templates 
     156        install -d $(DESTDIR)$(DATADIR)/templates 
    150157        $(ABSPERLRUN) -MExtUtils::Install -e 'install({ templates => @ARGV })' \\ 
    151                 $(DESTDIR)/usr/share/latmos-accounts/templates  
     158                $(DESTDIR)$(DATADIR)/templates 
     159 
     160install_data :: 
     161        install -d $(DESTDIR)$(DATADIR) 
     162        $(ABSPERLRUN) -MExtUtils::Install -e 'install({ sqldata => @ARGV })' \\ 
     163            $(DESTDIR)$(DATADIR) 
    152164]; 
    153165   
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm

    r880 r881  
    8383        $self->{_db}->do(q{set DATESTYLE to 'DMY'}); 
    8484        $self->log(LA_DEBUG, 'New connection to DB'); 
    85         my $sv = $self->get_global_value('schema_version') || 1; 
    86         if ($sv < $SCHEMA_VERSION) { 
    87             $self->log(LA_CRIT, 
    88                 "Schema version %d found, %d is need, please update db for `%s' base", 
    89                 $sv, 
    90                 $SCHEMA_VERSION, 
    91                 $self->label, 
    92             ); 
    93             # return; 
    94         } 
    9585        return $self->{_db}; 
    9686    } 
     
    10595sub load { 
    10696    my ($self) = @_; 
    107     return $self->db ? 1 : 0;     
     97    if (!$self->db) { return 0 }; 
     98 
     99    my $sv = $self->get_global_value('schema_version') || 1; 
     100    if ($sv < $SCHEMA_VERSION) { 
     101        $self->log(LA_CRIT, 
     102            "Schema version %d found, %d is need, please update db for `%s' base", 
     103            $sv, 
     104            $SCHEMA_VERSION, 
     105            $self->label, 
     106        ); 
     107        # return; 
     108    } 
     109 
     110    1; 
    108111} 
    109112 
Note: See TracChangeset for help on using the changeset viewer.