equal
deleted
inserted
replaced
|
1 #!/usr/bin/env python3.2 |
|
2 |
|
3 from pgtools import pgmanager, pgbrowser, pgdiff |
|
4 from toolbase import SrcDstTool |
|
5 |
|
6 |
|
7 class SchemaDiffTool(SrcDstTool): |
|
8 def __init__(self): |
|
9 SrcDstTool.__init__(self, name='schemadiff', desc='Database schema diff.') |
|
10 |
|
11 self.parser.add_argument('-s', dest='schema', nargs='*', help='Schema filter') |
|
12 self.parser.add_argument('-t', dest='table', nargs='*', help='Table filter') |
|
13 |
|
14 self.init() |
|
15 |
|
16 def main(self): |
|
17 srcbrowser = pgbrowser.PgBrowser(self.pgm.get_conn('src')) |
|
18 dstbrowser = pgbrowser.PgBrowser(self.pgm.get_conn('dst')) |
|
19 |
|
20 pgd = pgdiff.PgDiff(srcbrowser, dstbrowser) |
|
21 |
|
22 if self.args.schema: |
|
23 pgd.filter_schemas(include=self.args.schema) |
|
24 |
|
25 if self.args.table: |
|
26 pgd.filter_tables(include=self.args.table) |
|
27 |
|
28 pgd.print_diff() |
|
29 |
|
30 |
|
31 tool = SchemaDiffTool() |
|
32 tool.main() |