Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c0931303

Von Sven Schöling vor mehr als 11 Jahren hinzugefügt

  • ID c09313030ba77f61771483e69179fd916d9328cd
  • Vorgänger 07427030
  • Nachfolger b8b112a3

Rose Updatescript auf use_setup => 0 geändert.

Unterschiede anzeigen:

scripts/rose_auto_create_model.pl
95 95
__PACKAGE__->meta->schema('$schema');
96 96
CODE
97 97

  
98
  my $definition =  eval <<CODE;
98
  eval <<CODE;
99 99
    package SL::DB::AUTO::$package;
100 100
    use SL::DB::Object;
101 101
    use base qw(SL::DB::Object);
......
104 104
    $schema_str
105 105
    __PACKAGE__->meta->auto_initialize;
106 106

  
107
    __PACKAGE__->meta->perl_class_definition(indent => 2); # , braces => 'bsd'
108 107
CODE
109 108

  
110 109
  if ($EVAL_ERROR) {
......
113 112
    return;
114 113
  }
115 114

  
115
  my %args = (indent => 2, use_setup => 0);
116

  
117
  my $definition =  "SL::DB::AUTO::$package"->meta->perl_class_definition(%args);
118
  $definition =~ s/(__PACKAGE__->meta->initialize;)/# $1/;
116 119
  $definition =~ s/::AUTO::/::/g;
117 120

  
118
  while (my ($auto_generated_name, $desired_name) = each %{ $foreign_key_name_map{$table} || {} }) {
119
    $definition =~ s/( foreign_keys \s*=> \s*\[ .* ^\s+ ) ${auto_generated_name} \b/${1}${desired_name}/msx;
121
  # patch foreign keys
122
  my $foreign_key_definition = "SL::DB::AUTO::$package"->meta->perl_foreign_keys_definition(%args);
123

  
124
  if ($definition =~ /\Q$foreign_key_definition\E/) {
125
    my ($start, $end) = ($-[0], $+[0]);
126

  
127
    while (my ($auto_generated_name, $desired_name) = each %{ $foreign_key_name_map{$table} || {} }) {
128
      $foreign_key_definition =~ s/^ \s \s ${auto_generated_name} \b/  ${desired_name}/msx;
129
    }
130

  
131
    substr($definition, $start, $end - $start) = $foreign_key_definition;
120 132
  }
121 133

  
122
  $definition =~ s/(table\s*=>.*?\n)/$1  schema  => '${schema}',\n/ if $schema;
134
  $definition =~ s/(meta->table.*)\n/$1\n$schema_str/m if $schema;
123 135

  
124 136
  my $full_definition = <<CODE;
125 137
# This file has been auto-generated. Do not modify it; it will be overwritten
......
137 149

  
138 150
use SL::DB::MetaSetup::${package};
139 151

  
152
__PACKAGE__->meta->initialize;
153

  
140 154
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
141 155
__PACKAGE__->meta->make_manager_class;
142 156

  

Auch abrufbar als: Unified diff