def define_fields(cls, dbmanager): """This class-level function defines the database fields for this model -- the columns, etc.""" fieldlist = [ # standard primary id number field mdbfield.DbfPrimaryId( 'id', {'label': "The primary key and id# for this row"}), # an arbitrarily long string serializing any other log properties that we don't have explicit fields for. mdbfield.DbfSerialized( 'extrafields_serialized', {'label': "Arbitrary dictionary of extra fields"}), # actual log msg text mdbfield.DbfTimestamp('timestamp', {'label': "The timestamp for the message"}), # actual log msg text mdbfield.DbfText('msg', {'label': "The text message"}), # actual log msg text mdbfield.DbfString('source', {'label': "The source of the message"}), # actual log msg text mdbfield.DbfString('type', {'label': "The type of the message"}), # globally unique subject reference (usually the user logged in) mdbmixins.dbfmixin_gobreference('subject'), # globally unique resource reference (could be a document, group, thread, etc.) mdbmixins.dbfmixin_gobreference('resource'), ] return fieldlist
def define_fields(cls, dbmanager): """This class-level function defines the database fields for this model.""" # starting field list is just primary id fieldlist = [ # standard primary id number field mdbfield.DbfPrimaryId( 'id', {'label': "The primary key and id# for this row"}), # foreign key to left mdbfield.DbfForeignKey( cls.leftclass.get_dbtablename() + '_id', { 'label': "Left hand side of association ({0})".format( cls.leftclass.__name__), 'foreignkeyname': cls.leftclass.get_dbtablename() + '.id', }), # foreign key to right mdbfield.DbfForeignKey( cls.rightclass.get_dbtablename() + '_id', { 'label': "Right hand side of association ({0})".format( cls.rightclass.__name__), 'foreignkeyname': cls.rightclass.get_dbtablename() + '.id', }), ] return fieldlist
def define_fields(cls, dbmanager): """This class-level function defines the database fields for this model.""" # leftcollectionname = cls.leftclass.get_dbtablename() + 's' rightitemname = cls.rightclass.get_dbtablename() rightcollectionname = cls.rightclass.get_dbtablename() + 's' leftitemname = cls.leftclass.get_dbtablename() # starting field list is just primary id fieldlist = [ # standard primary id number field mdbfield.DbfPrimaryId( 'id', {'label': "The primary key and id# for this row"}), # foreign key to left mdbfield.DbfForeignKey( cls.leftclass.get_dbtablename() + '_id', { 'label': "Left hand side of association ({0})".format( cls.leftclass.__name__), 'foreignkeyname': cls.leftclass.get_dbtablename() + '.id', }), # foreign key to right mdbfield.DbfForeignKey( cls.rightclass.get_dbtablename() + '_id', { 'label': "Right hand side of association ({0})".format( cls.rightclass.__name__), 'foreignkeyname': cls.rightclass.get_dbtablename() + '.id', }), # ok now this association class is like a 1-N-1 relationship between the two classes # add a relationship from this intermediate association to the right class and back mdbfield.DbfNtoM_SimpleRelation( rightitemname, { 'associationclass': None, 'otherclass': cls.rightclass, 'backrefname': leftcollectionname }), # now we try doing the other side (and back) # ATTN: now that we have moved this code, the direction of the backref is changed -- we should make sure there arent unintended consequences mdbfield.DbfNtoM_SimpleRelation( leftitemname, { 'associationclass': None, 'otherclass': cls.leftclass, 'backrefname': rightcollectionname }), ] return fieldlist
def define_fields(cls, dbmanager): """This class-level function defines the database fields for this model -- the columns, etc.""" # define fields list fieldlist = [ # standard primary id number field mdbfield.DbfPrimaryId('id', { 'label': "The primary key and id# for this item" }), # an arbitrarily long string serializing any other log properties that we don't have explicit fields for. mdbfield.DbfTypeString('objecttype', { 'label': "The object type referred to, as a string" }), ] return fieldlist
def define_fields(cls, dbmanager): """This class-level function defines the database fields for this model.""" ownerfieldid = cls.ownerclass.get_dbtablename() + '_id' fieldlist = [ # standard primary id number field mdbfield.DbfPrimaryId( 'id', {'label': "The primary key and id# for this row"}), # and now we are going to add a 1-to-1 field from us back to the object we are properties foe mdbfield.Dbf1to1_Right( ownerfieldid, { 'label': 'Reference to owner object', 'leftclass': cls.ownerclass, }), ] return fieldlist
def define_fields(cls, dbmanager): """This class-level function defines the database fields for this model -- the columns, etc.""" # define fields list fieldlist = [ # standard primary id number field mdbfield.DbfPrimaryId( 'id', {'label': "The primary key and id# for this row"}), # a unique short text keyname mdbfield.DbfUniqueKeyname( 'keyname', {'label': "The unique key name for this group of properties"}), # an arbitrarily long string serializing a dictionary or array, etc. mdbfield.DbfSerialized( 'settingdict_serialized', { 'label': "The serialzed text version of the dictionary/array data being stored" }) ] return fieldlist