本文整理汇总了Python中trac.db.api.DatabaseManager.create_tables方法的典型用法代码示例。如果您正苦于以下问题:Python DatabaseManager.create_tables方法的具体用法?Python DatabaseManager.create_tables怎么用?Python DatabaseManager.create_tables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.db.api.DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager.create_tables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upgrade_environment
# 需要导入模块: from trac.db.api import DatabaseManager [as 别名]
# 或者: from trac.db.api.DatabaseManager import create_tables [as 别名]
def upgrade_environment(self):
"""
Actually perform an environment upgrade, but don't commit as
that is done by the common upgrade procedure when all plugins are done.
"""
dbm = DatabaseManager(self.env)
current_ver = dbm.get_database_version(db_version_key)
if current_ver == 0:
dbm.create_tables(schema.values())
else:
while current_ver + 1 <= db_version:
upgrade_map[current_ver + 1](self.env)
current_ver += 1
dbm.set_database_version(db_version, db_version_key)
示例2: upgrade_environment
# 需要导入模块: from trac.db.api import DatabaseManager [as 别名]
# 或者: from trac.db.api.DatabaseManager import create_tables [as 别名]
def upgrade_environment(self, db):
dbm = DatabaseManager(self.env)
pluginName = 'wikimeta_version'
schema_ver = self.get_schema_version(db=db, pluginName=pluginName)
if schema_ver == 0:
dbm.create_tables(PLUGIN_SCHEMA)
cursor = db.cursor()
cursor.execute("""
INSERT into system (name, value)
values (%s,%s)
""", (pluginName, PLUGIN_DB_VERSION))
self.log.info("initialized wikimeta db schema: %d to %d"
% (schema_ver, PLUGIN_DB_VERSION))
db.commit()
示例3: upgrade_from_2_to_3
# 需要导入模块: from trac.db.api import DatabaseManager [as 别名]
# 或者: from trac.db.api.DatabaseManager import create_tables [as 别名]
def upgrade_from_2_to_3(env):
# Add the new table
dbm = DatabaseManager(env)
dbm.create_tables((schema['code_comments_subscriptions'],))