Add an architecture field to the autoinstaller table
[invirt/packages/invirt-database.git] / python / database / models.py
index e44aff3..f3d36e9 100644 (file)
@@ -79,7 +79,8 @@ autoinstalls_table = Table('autoinstalls', meta,
        Column('description', String, nullable=False),
        Column('type_id', String, ForeignKey('types.type_id'), nullable=False),
        Column('distribution', String, nullable=False),
-       Column('mirror', String, nullable=False))
+       Column('mirror', String, nullable=False),
+       Column('arch', String, nullable=False))
 
 machine_access_table = Table('machine_access', meta,
        Column('machine_id', Integer, ForeignKey('machines.machine_id', ondelete='CASCADE'), nullable=False, index=True),
@@ -128,7 +129,8 @@ session.mapper(NIC, nic_table)
 session.mapper(Disk, disk_table)
 session.mapper(Type, types_table)
 session.mapper(Mirror, mirrors_table)
-session.mapper(CDROM, cdroms_table)
+session.mapper(CDROM, cdroms_table,
+               properties={'mirror': relation(Mirror, backref="cdroms")})
 session.mapper(Autoinstall, autoinstalls_table)
 
 def clear_cache():