Commit 1710a619 authored by mmn's avatar mmn

Magicsig class now Managed_DataObject with nicer schemaDef

parent ade2bdc3
......@@ -81,39 +81,21 @@ class Magicsig extends Managed_DataObject
$this->alg = $alg;
}
function table()
public static function schemaDef()
{
return array(
'user_id' => DB_DATAOBJECT_INT,
'keypair' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
'alg' => DB_DATAOBJECT_STR
'fields' => array(
'user_id' => array('type' => 'int', 'not null' => true, 'description' => 'user id'),
'keypair' => array('type' => 'text', 'description' => 'keypair text representation', 'collate' => 'utf8_general_ci'),
'alg' => array('type' => 'varchar', 'length' => 64, 'description' => 'algorithm'),
),
'primary key' => array('user_id'),
'foreign keys' => array(
'magicsig_user_id_fkey' => array('user', array('user_id' => 'id')),
),
);
}
static function schemaDef()
{
return array(new ColumnDef('user_id', 'integer',
null, false, 'PRI'),
new ColumnDef('keypair', 'text',
false, false),
new ColumnDef('alg', 'varchar',
64, false));
}
function keys()
{
return array_keys($this->keyTypes());
}
function keyTypes()
{
return array('user_id' => 'K');
}
function sequenceKey() {
return array(false, false, false);
}
/**
* Save this keypair into the database.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment