Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4766711a68
Fetching contributors…

Cannot retrieve contributors at this time

executable file 38 lines (37 sloc) 0.756 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
#!/usr/bin/perl
use IPC::Open3;
use Fatal qw(open open3);
my $schema = 'lixuz_schema.sql';

if (@ARGV)
{
    $schema = shift(@ARGV);
}
open3(my $in, my $out, my $err,'mysqldump','-ulixuz','-pli09uz31','-d','lixuz');
open(my $outf, '>',$schema);
my $seenDM = 0;
while($_ = <$out>)
{
    if ($seenDM)
    {
        if (/^--* Table/)
        {
            $seenDM = 0;
        }
        else
        {
            next;
        }
    }
    elsif(/lz_dm_map/)
    {
        $seenDM = 1;
        next;
    }
    s/AUTO_INCREMENT=\d+//g;
    s/\s+DEFAULT/ DEFAULT/g;
    s/\s+CHARSET=latin1/ CHARSET=utf8/g;
    print {$outf} $_;
}
close($outf);close($in);close($out);close($err);
print "Wrote $schema\n";
print "NOTE: If you ADDED tables, modify upgradeDB!\n";
Something went wrong with that request. Please try again.