##// END OF EJS Templates
Added missing FK to migration
marcink -
r908:de560c47 beta
parent child Browse files
Show More
@@ -6,7 +6,6 b' from sqlalchemy.exc import DatabaseError'
6 from sqlalchemy.orm import relation, backref, class_mapper
6 from sqlalchemy.orm import relation, backref, class_mapper
7 from sqlalchemy.orm.session import Session
7 from sqlalchemy.orm.session import Session
8
8
9
10 from rhodecode.lib.dbmigrate.migrate import *
9 from rhodecode.lib.dbmigrate.migrate import *
11 from rhodecode.lib.dbmigrate.migrate.changeset import *
10 from rhodecode.lib.dbmigrate.migrate.changeset import *
12
11
@@ -35,20 +34,14 b' def upgrade(migrate_engine):'
35 #==========================================================================
34 #==========================================================================
36 # Upgrade of `repositories` table
35 # Upgrade of `repositories` table
37 #==========================================================================
36 #==========================================================================
38 tblname = 'repositories'
37 from rhodecode.model.db import Repository
39 tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True,
40 autoload_with=migrate_engine)
41
38
42 #ADD group_id column#
39 #ADD group_id column#
43 group_id = Column("group_id", Integer(), #ForeignKey('groups.group_id'),
40 group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'),
44 nullable=True, unique=False, default=None)
41 nullable=True, unique=False, default=None)
45
42
46 group_id.create(tbl)
43 group_id.create(Repository().__table__)
47
44
48 # TODO: fix this somehow ?!
49 # cons = ForeignKeyConstraint([tbl.c.group_id], ['groups.group_id'], table=tbl)
50 #
51 # cons.create()
52 return
45 return
53
46
54
47
General Comments 0
You need to be logged in to leave comments. Login now