From: Mikael Nordfeldth Date: Sun, 18 Aug 2013 13:31:18 +0000 (+0200) Subject: Magicsig class now Managed_DataObject with nicer schemaDef X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1710a619a8e6729ca3e4d3465cdb2f98353627fb;p=quix0rs-gnu-social.git Magicsig class now Managed_DataObject with nicer schemaDef --- diff --git a/plugins/OStatus/classes/Magicsig.php b/plugins/OStatus/classes/Magicsig.php index 01c4689676..4a703ae3b7 100644 --- a/plugins/OStatus/classes/Magicsig.php +++ b/plugins/OStatus/classes/Magicsig.php @@ -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. *