create_role.py
875 Bytes
#!/usr/bin/python
# coding: utf-8
import config
dbname_fix="USER"
tablename_fix="t_role"
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',
nick char(32) not null default '' comment '昵称',
last_logout_time int(11) unsigned not null default '0' comment '下线时间',
ct_time int(11) unsigned not null default '0' comment '创建角色时间',
last_login_time int(11) unsigned not null default '0' comment '上线时间',
head int(11) unsigned not null default '0' comment '头像',
primary key (uid),
unique key nick (nick)
)engine=innodb default charset=utf8;
""" %(db_name,tablename_fix,j,db_name,tablename_fix,j)