Mercurial > kallithea
diff rhodecode/lib/dbmigrate/versions/004_version_1_3_0.py @ 2000:72c525a7e7ad beta
added migrations from 1.2.X to 1.3
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 19 Feb 2012 17:41:07 +0200 |
parents | cf51bbfb120e |
children | fa6ba6727475 |
line wrap: on
line diff
--- a/rhodecode/lib/dbmigrate/versions/004_version_1_3_0.py Sun Feb 19 05:15:04 2012 +0200 +++ b/rhodecode/lib/dbmigrate/versions/004_version_1_3_0.py Sun Feb 19 17:41:07 2012 +0200 @@ -13,12 +13,58 @@ log = logging.getLogger(__name__) + def upgrade(migrate_engine): """ Upgrade operations go here. Don't create your own engine; bind migrate_engine to your metadata """ + #========================================================================== + # Add table `users_group_repo_group_to_perm` + #========================================================================== + from rhodecode.lib.dbmigrate.schema.db_1_3_0 import UsersGroupRepoGroupToPerm + UsersGroupRepoGroupToPerm().__table__.create() + #========================================================================== + # Add table `changeset_comments` + #========================================================================== + from rhodecode.lib.dbmigrate.schema.db_1_3_0 import ChangesetComment + ChangesetComment().__table__.create() + #========================================================================== + # Add table `notifications` + #========================================================================== + from rhodecode.lib.dbmigrate.schema.db_1_3_0 import Notification + Notification().__table__.create() + + #========================================================================== + # Add table `user_to_notification` + #========================================================================== + from rhodecode.lib.dbmigrate.schema.db_1_3_0 import UserNotification + UserNotification().__table__.create() + + #========================================================================== + # Add unique to table `users_group_to_perm` + #========================================================================== + from rhodecode.lib.dbmigrate.schema.db_1_3_0 import UsersGroupToPerm + tbl = UsersGroupToPerm().__table__ + cons = UniqueConstraint('users_group_id', 'permission_id', table=tbl) + cons.create() + + #========================================================================== + # Fix unique constrain on table `user_logs` + #========================================================================== + from rhodecode.lib.dbmigrate.schema.db_1_3_0 import UserLog + tbl = UserLog().__table__ + col = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), + nullable=False, unique=None, default=None) + col.alter(nullable=True, table=tbl) + + #========================================================================== + # Rename table `group_to_perm` to `user_repo_group_to_perm` + #========================================================================== + tbl = Table('group_to_perm', MetaData(bind=migrate_engine), autoload=True, + autoload_with=migrate_engine) + tbl.rename('user_repo_group_to_perm') return