Ignore:
Timestamp:
Oct 29, 2009, 3:40:41 AM (15 years ago)
Author:
broder
Message:

Add builds and build_logs tables to invirt-database for tracking build
history and logs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-database/python/database/models.py

    r2225 r2535  
    55from sqlalchemy.ext.sessioncontext import SessionContext
    66from sqlalchemy.ext.assignmapper import assign_mapper
     7
     8import datetime
    79
    810from invirt.database import record
     
    2123           'owners_table',
    2224           'admins_table',
     25           'builds_table',
    2326           'Machine',
    2427           'MachineAccess',
     
    3134           'Owner',
    3235           'Admin',
     36           'Build',
    3337           'or_',
    3438           ]
     
    99103       Column('vms_quota_active', Integer, nullable=True, default=None))
    100104
     105builds_table = Table('builds', meta,
     106       Column('build_id', Integer, primary_key=True, nullable=False),
     107       Column('package', String, nullable=False),
     108       Column('pocket', String, nullable=False),
     109       Column('commit', String, nullable=False),
     110       Column('version', String, nullable=True, default=None),
     111       Column('principal', String, nullable=False),
     112       Column('succeeded', Boolean, nullable=False),
     113       Column('failed_stage', String, nullable=True, default=None),
     114       Column('inserted_at', DateTime, nullable=False, default=datetime.datetime.utcnow))
     115
    101116machine_access_table = Table('machine_access', meta,
    102117       Column('machine_id', Integer, ForeignKey('machines.machine_id', ondelete='CASCADE'), nullable=False, index=True),
     
    134149    _identity_field = 'user'
    135150
     151class Build(record.Record):
     152    _identity_field = 'build_id'
     153
    136154from invirt.database.owner import Owner
    137155
     
    151169session.mapper(Owner, owners_table)
    152170session.mapper(Admin, admins_table)
     171session.mapper(Build, builds_table)
    153172
    154173def clear_cache():
Note: See TracChangeset for help on using the changeset viewer.