1 # this move is about adding a authority x user many to many relation ship for modelling PIs
2 # that is to say users who can vouch for other users in the authority, and
5 from sqlalchemy import Table, MetaData, Column, ForeignKey
6 from sqlalchemy import Integer, String
10 # this is needed by migrate so it can locate 'records.record_id'
12 Table('records', metadata,
13 Column('record_id', Integer, primary_key=True),
16 # authority x user (PIs) association
17 authority_pi_table = \
18 Table('authority_pi', metadata,
19 Column('authority_id', Integer, ForeignKey(
20 'records.record_id'), primary_key=True),
21 Column('pi_id', Integer, ForeignKey(
22 'records.record_id'), primary_key=True),
26 def upgrade(migrate_engine):
27 metadata.bind = migrate_engine
28 authority_pi_table.create()
31 def downgrade(migrate_engine):
32 metadata.bind = migrate_engine
33 authority_pi_table.drop()