g.add_option("--skip-truncate", action="store_true", dest="skip_truncate",
help = "add: keep old data", default=False)
g.add_option("--create", action="store_true",
- help = "add: create table/seq if not exist")
- g.add_option("--create-only",
- help = "add: create table/seq if not exist (seq,pkey,full,indexes,fkeys)")
+ help = "add: create table/seq if not exist, with minimal schema")
+ g.add_option("--create-full", action="store_true",
+ help = "add: create table/seq if not exist, with full schema")
g.add_option("--trigger-flags",
help="add: Set trigger flags (BAIUDLQ)")
g.add_option("--trigger-arg", action="append",
p.add_option("--all", action="store_true",
help="include all tables", default=False)
p.add_option("--create", action="store_true",
- help="include all tables", default=False)
- p.add_option("--create-only",
- help="pkey,fkeys,indexes")
+ help="create, minimal", default=False)
+ p.add_option("--create-full", action="store_true",
+ help="create, full")
p.add_option("--trigger-flags",
help="Set trigger flags (BAIUDLQ)")
p.add_option("--trigger-arg", action="append",
sys.exit(1)
# pick proper create flags
- create = self.options.create_only
- if not create and self.options.create:
- create = 'full'
-
- fmap = {
- "full": skytools.T_ALL,
- "pkey": skytools.T_PKEY,
- }
- create_flags = 0
- if create:
- create_flags = skytools.T_TABLE
- for f in create.split(','):
- if f not in fmap:
- raise Exception("bad --create-only flag: " + f)
- create_flags |= fmap[f]
+ if self.options.create_full:
+ create_flags = skytools.T_ALL
+ elif self.options.create:
+ create_flags = skytools.T_TABLE | skytools.T_PKEY
+ else:
+ create_flags = 0
# seems ok
for tbl in args:
args = self.expand_arg_list(dst_db, 'S', False, args)
# pick proper create flags
- create = self.options.create_only
- if not create and self.options.create:
- create = 'full'
-
- fmap = {
- "full": skytools.T_SEQUENCE,
- }
- create_flags = 0
- if create:
- for f in create.split(','):
- if f not in fmap:
- raise Exception("bad --create-only flag: " + f)
- create_flags += fmap[f]
+ if self.options.create_full:
+ create_flags = skytools.T_SEQUENCE
+ elif self.options.create:
+ create_flags = skytools.T_SEQUENCE
+ else:
+ create_flags = 0
# seems ok
for seq in args:
for db in db2 db3 db4 db5; do
run psql -d $db -c "create sequence mytable_id_seq"
run londiste3 $v conf/londiste_db1.ini add-seq mytable_id_seq
- run londiste3 $v conf/londiste_$db.ini add-table mytable --create
+ run londiste3 $v conf/londiste_$db.ini add-table mytable --create-full
done
msg "Register another table to test unregistration"
run psql -d db1 -c "create table mytable2 (id int4 primary key, data text)"
run londiste3 $v conf/londiste_db1.ini add-table mytable2
for db in db2 db3 db4 db5; do
- run londiste3 $v conf/londiste_$db.ini add-table mytable2 --create-only=pkey
+ run londiste3 $v conf/londiste_$db.ini add-table mytable2 --create
done
msg "Wait until tables are in sync on db5"