Ejemplo n.º 1
0
def AutoId(name, seqname, pk=False):
    column = Num(name)
    c = column.constraint
    c.unique = True
    c.null = False
    c.pk = pk
    column.set_auto_increment(seqname)
    return column
Ejemplo n.º 2
0
 def __init__(self, suite, traits_table):
     tablename = ujoin(suite, 'scripts')
     script_column = PkName('script')
     script_column.set_fk('scriptnames')
     sfile_column = Num('scriptfile')
     sfile_column.set_fk('textfiles')
     script_columns = [script_column, sfile_column]
     _TraitRelation.__init__(self, traits_table, tablename, script_columns)
Ejemplo n.º 3
0
 def __init__(self):
     idcol = AutoId('contactid', 'contact_ident')
     name = PkName('name')
     address = Num('addressid')
     address.set_fk('addresses', 'addressid')
     email = PkBigname('email')
     desc = Text('description')
     Table.__init__(self, 'contacts', [idcol, name, address, email, desc])
Ejemplo n.º 4
0
 def __init__(self, suite, traits_table):
     tablename = ujoin(suite, 'scripts')
     script_column = PkName('script')
     script_column.set_fk('scriptnames')
     sfile_column = Num('scriptfile')
     sfile_column.set_fk('textfiles')
     script_columns = [script_column, sfile_column]
     _TraitRelation.__init__(self, traits_table, tablename, script_columns)
Ejemplo n.º 5
0
 def __init__(self, fs_table, mounts_table):
     fs_col = PkName('filesystem')
     fs_col.set_fk(fs_table)
     mnt_name_col = PkName('mnt_name')
     mnt_name_col.set_fk(mounts_table)
     ord_col = Num('ord')
     partition_column = Num('partition')
     columns = [fs_col, mnt_name_col, ord_col, partition_column]
     Table.__init__(self, 'filesystem_mounts', columns)
Ejemplo n.º 6
0
 def __init__(self, machines_table):
     machine_col = PkName('machine')
     machine_col.set_fk(machines_table)
     tablename = ujoin('machine', 'scripts')
     script_column = PkName('script')
     script_column.set_fk('scriptnames')
     sfile_column = Num('scriptfile')
     sfile_column.set_fk('textfiles')
     columns = [machine_col, script_column, sfile_column]
     Table.__init__(self, tablename, columns)
Ejemplo n.º 7
0
 def __init__(self, mach_types_table):
     mtype_col = PkName('machine_type')
     mtype_col.set_fk(mach_types_table)
     tablename = ujoin('machine_type', 'scripts')
     script_column = PkName('script')
     script_column.set_fk('scriptnames')
     sfile_column = Num('scriptfile')
     sfile_column.set_fk('textfiles')
     script_columns = [mtype_col, script_column, sfile_column]
     Table.__init__(self, tablename, script_columns)
Ejemplo n.º 8
0
 def __init__(self):
     ticket = Num('ticketid')
     ticket.set_fk('tickets')
     actionid = AutoId('actionid', 'action_ident', pk=True)
     subject = Bigname('subject')
     action = Name('action')
     author = Name('author')
     posted = Now('posted')
     data = Text('data')
     cols = [ticket, actionid, subject, action, author, posted, data]
     Table.__init__(self, 'ticketactions', cols)
Ejemplo n.º 9
0
 def __init__(self):
     troubleid = AutoId('troubleid', 'trouble_ident', pk=True)
     clientid = Num('clientid')
     clientid.set_fk('clients')
     problem = Name('problem')
     worktodo= Text('worktodo')
     posted = Now('posted')
     status = Name('status')
     status.set_fk('trouble_status')
     cols = [troubleid, clientid, problem, worktodo, posted, status]
     Table.__init__(self, 'troubles', cols)
Ejemplo n.º 10
0
 def __init__(self):
     clientid = Num('clientid')
     clientid.set_fk('clients')
     locationid = Num('locationid')
     locationid.set_fk('locations', 'locationid')
     contactid = Num('contactid')
     contactid.set_fk('contacts', 'contactid')
     cols = [clientid, locationid, contactid]
     Table.__init__(self, 'clientinfo', cols)
Ejemplo n.º 11
0
def template_columns():
    return [
        PkBigname('template'),
        Name('mode'),
        Name('owner'),
        Name('grp_owner'),
        Num('templatefile')]
Ejemplo n.º 12
0
 def __init__(self, profiles_table, traits_table):
     profile_col = PkName('profile')
     profile_col.set_fk(profiles_table)
     trait_col = PkName('trait')
     trait_col.set_fk(traits_table)
     ord_col = Num('ord')
     Table.__init__(self, 'profile_trait', [profile_col, trait_col, ord_col])
Ejemplo n.º 13
0
def packages_columns():
    return [
        PkBigname('package'),
        Name('priority'),
        Bigname('section'),
        Num('installedsize'),
        Bigname('filename'),
        Bigname('maintainer'),
        Bigname('size'),
        Name('md5sum'),
        Bigname('version'),
        Text('description')]
Ejemplo n.º 14
0
from useless.sqlgen.classes import Column, Table
from useless.sqlgen.defaults import Text
from useless.sqlgen.defaults import PkBigname, Bigname, Name, Num

dpkg_tables = ['available', 'status', 'filelist', 'md5sums', 'conffiles']
other_tables = ['current']


common_columns = [
    PkBigname('package'),
    Name('essential'),
    Name('priority'),
    Name('section'),
    Num('installedsize'),
    Bigname('maintainer'),
    Name('version')
    ]
    

#columns for /var/lib/dpkg/status
status_columns = common_columns + [
    Name('status'),
    Text('replaces'),
    Text('provides'),
    Text('predepends'),
    Text('conflicts'),
    Bigname('source'),
    Text('suggests'),
    Text('recommends'),
    Text('depends'),
Ejemplo n.º 15
0
def partition_columns():
    return [PkName('partition'), Num('start'), Num('size'), Num('Id')]
Ejemplo n.º 16
0
 def __init__(self, name, mach_types_table):
     mtype_col = PkName('machine_type')
     mtype_col.set_fk(mach_types_table)
     columns = [mtype_col, PkName('module'), Num('ord')]
     Table.__init__(self, name, columns)
Ejemplo n.º 17
0
 def __init__(self, mounts_table):
     mnt_name_col = PkName('mnt_name')
     mnt_name_col.set_fk(mounts_table)
     partition_col = Num('partition')
     columns = [mnt_name_col, partition_col]
     Table.__init__(self, 'partition_mounts', columns)
Ejemplo n.º 18
0
 def __init__(self):
     suite = PkName('suite')
     apt_id = PkName('apt_id')
     order = Num('ord')
     name = 'suite_apt_sources'
     Table.__init__(self, name, [suite, apt_id, order])
Ejemplo n.º 19
0
 def __init__(self):
     magnet = PkName('magnet')
     magnet.set_fk('magnets')
     troubleid = Num('troubleid')
     troubleid.set_fk('troubles')
     Table.__init__(self, 'trouble_magnets', [magnet, troubleid])