##// END OF EJS Templates
i18n fix
i18n fix

File last commit:

r3148:b3198497 beta
r3373:cab58d49 beta
Show More
008_version_1_5_0.py
62 lines | 2.0 KiB | text/x-python | PythonLexer
implemented #663 Admin/permission: specify default repogroup perms...
r3052 import logging
import datetime
from sqlalchemy import *
from sqlalchemy.exc import DatabaseError
Implemented better support for Wildcard queries...
r3063 from sqlalchemy.orm import relation, backref, class_mapper, joinedload
implemented #663 Admin/permission: specify default repogroup perms...
r3052 from sqlalchemy.orm.session import Session
from sqlalchemy.ext.declarative import declarative_base
from rhodecode.lib.dbmigrate.migrate import *
from rhodecode.lib.dbmigrate.migrate.changeset import *
from rhodecode.model.meta import Base
from rhodecode.model import meta
Migration upgrades cache for lightweight dashboard...
r3148 from rhodecode.lib.dbmigrate.versions import _reset_base
implemented #663 Admin/permission: specify default repogroup perms...
r3052
log = logging.getLogger(__name__)
def upgrade(migrate_engine):
"""
Upgrade operations go here.
Don't create your own engine; bind migrate_engine to your metadata
"""
Implemented better support for Wildcard queries...
r3063 #==========================================================================
# USER LOGS
#==========================================================================
Migration upgrades cache for lightweight dashboard...
r3148 _reset_base(migrate_engine)
Implemented better support for Wildcard queries...
r3063 from rhodecode.lib.dbmigrate.schema.db_1_5_0 import UserLog
tbl = UserLog.__table__
username = Column("username", String(255, convert_unicode=False,
assert_unicode=None), nullable=True,
unique=None, default=None)
# create username column
username.create(table=tbl)
fixed migrations
r3086 _Session = Session()
## after adding that column fix all usernames
users_log = _Session.query(UserLog)\
.options(joinedload(UserLog.user))\
.options(joinedload(UserLog.repository)).all()
for entry in users_log:
entry.username = entry.user.username
_Session.add(entry)
_Session.commit()
#alter username to not null
remove not null from user_id column for users log archiving
r3065 from rhodecode.lib.dbmigrate.schema.db_1_5_0 import UserLog
tbl_name = UserLog.__tablename__
tbl = Table(tbl_name,
MetaData(bind=migrate_engine), autoload=True,
autoload_with=migrate_engine)
fixed migrations
r3086 col = tbl.columns.username
remove not null from user_id column for users log archiving
r3065
# remove nullability from revision field
fixed migrations
r3086 col.alter(nullable=False)
implemented #663 Admin/permission: specify default repogroup perms...
r3052
Implemented #379 defaults settings page for creation of repositories...
r3056
implemented #663 Admin/permission: specify default repogroup perms...
r3052 def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine