##// 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 6 from sqlalchemy.orm import relation, backref, class_mapper
7 7 from sqlalchemy.orm.session import Session
8 8
9
10 9 from rhodecode.lib.dbmigrate.migrate import *
11 10 from rhodecode.lib.dbmigrate.migrate.changeset import *
12 11
@@ -35,20 +34,14 b' def upgrade(migrate_engine):'
35 34 #==========================================================================
36 35 # Upgrade of `repositories` table
37 36 #==========================================================================
38 tblname = 'repositories'
39 tbl = Table(tblname, MetaData(bind=migrate_engine), autoload=True,
40 autoload_with=migrate_engine)
37 from rhodecode.model.db import Repository
41 38
42 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 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 45 return
53 46
54 47
General Comments 0
You need to be logged in to leave comments. Login now