Changeset 10
- Timestamp:
- 04/06/05 19:18:53 (4 years ago)
- Files:
-
- mt-db-convert/trunk/mt-db-convert.cgi (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
mt-db-convert/trunk/mt-db-convert.cgi
r1 r10 151 151 } 152 152 153 ## %ids will hold the highest IDs of each class. 153 154 my %ids; 154 155 … … 177 178 $ids{$class} = $o->id 178 179 if !$ids{$class} || $o->id > $ids{$class}; 179 180 ## Look for duplicate template, category, and author names, 181 ## because we have uniqueness constraints in the DB. 180 182 if ($class eq 'MT::Template') { 181 183 my $key = lc($o->name) . $o->blog_id; … … 217 219 } 218 220 219 220 221 $i++; 221 222 print $o->save ? "." : "!<br />" . $o->errstr; … … 225 226 print "</p>\n\n"; 226 227 } 228 229 if ($type eq 'postgres') { 230 print "Updating sequences\n"; 231 my $dbh = MT::Object->driver->{dbh}; 232 for my $class (keys %ids) { 233 print " $class => $ids{$class}\n"; 234 my $seq = 'mt_' . $class->datasource . '_' . 235 $class->properties->{primary_key}; 236 $dbh->do("select setval('$seq', $ids{$class})") 237 or die $dbh->errstr; 238 } 239 } 240 227 241 }; 228 242
