comparison 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
comparison
equal deleted inserted replaced
1999:6b474c01ba98 2000:72c525a7e7ad
11 11
12 from rhodecode.model.meta import Base 12 from rhodecode.model.meta import Base
13 13
14 log = logging.getLogger(__name__) 14 log = logging.getLogger(__name__)
15 15
16
16 def upgrade(migrate_engine): 17 def upgrade(migrate_engine):
17 """ Upgrade operations go here. 18 """ Upgrade operations go here.
18 Don't create your own engine; bind migrate_engine to your metadata 19 Don't create your own engine; bind migrate_engine to your metadata
19 """ 20 """
21 #==========================================================================
22 # Add table `users_group_repo_group_to_perm`
23 #==========================================================================
24 from rhodecode.lib.dbmigrate.schema.db_1_3_0 import UsersGroupRepoGroupToPerm
25 UsersGroupRepoGroupToPerm().__table__.create()
20 26
27 #==========================================================================
28 # Add table `changeset_comments`
29 #==========================================================================
30 from rhodecode.lib.dbmigrate.schema.db_1_3_0 import ChangesetComment
31 ChangesetComment().__table__.create()
21 32
33 #==========================================================================
34 # Add table `notifications`
35 #==========================================================================
36 from rhodecode.lib.dbmigrate.schema.db_1_3_0 import Notification
37 Notification().__table__.create()
38
39 #==========================================================================
40 # Add table `user_to_notification`
41 #==========================================================================
42 from rhodecode.lib.dbmigrate.schema.db_1_3_0 import UserNotification
43 UserNotification().__table__.create()
44
45 #==========================================================================
46 # Add unique to table `users_group_to_perm`
47 #==========================================================================
48 from rhodecode.lib.dbmigrate.schema.db_1_3_0 import UsersGroupToPerm
49 tbl = UsersGroupToPerm().__table__
50 cons = UniqueConstraint('users_group_id', 'permission_id', table=tbl)
51 cons.create()
52
53 #==========================================================================
54 # Fix unique constrain on table `user_logs`
55 #==========================================================================
56 from rhodecode.lib.dbmigrate.schema.db_1_3_0 import UserLog
57 tbl = UserLog().__table__
58 col = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'),
59 nullable=False, unique=None, default=None)
60 col.alter(nullable=True, table=tbl)
61
62 #==========================================================================
63 # Rename table `group_to_perm` to `user_repo_group_to_perm`
64 #==========================================================================
65 tbl = Table('group_to_perm', MetaData(bind=migrate_engine), autoload=True,
66 autoload_with=migrate_engine)
67 tbl.rename('user_repo_group_to_perm')
22 68
23 return 69 return
24 70
25 71
26 def downgrade(migrate_engine): 72 def downgrade(migrate_engine):