ct_pet.py
699 Bytes
#!/usr/bin/python
# coding: utf-8
import config
dbname_fix="USER"
tablename_fix="t_pet"
db_count=10
table_count=10
for i in range (db_count):
db_name= "%s_%s_%01d"%(config.server_index,dbname_fix,i)
for j in range(table_count):
print """
drop table if exists %s.%s_%01d;create table %s.%s_%01d(
uid bigint(18) unsigned not null comment'用户id',
pet_id int(11) unsigned not null comment '宠物id',
val int(11) unsigned not null comment '好感度',
exp int(11) unsigned not null comment 'exp',
cnt int(11) unsigned not null comment '数量',
primary key (uid, pet_id)
)engine=innodb default charset=utf8;
""" %(db_name,tablename_fix,j,db_name,tablename_fix,j)