本文整理匯總了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'],))