Token.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. // This file is part of GNU social - https://www.gnu.org/software/social
  3. //
  4. // GNU social is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // GNU social is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  16. /**
  17. * Table Definition for token
  18. */
  19. defined('GNUSOCIAL') || die();
  20. class Token extends Managed_DataObject
  21. {
  22. ###START_AUTOCODE
  23. /* the code below is auto generated do not remove the above tag */
  24. public $__table = 'token'; // table name
  25. public $consumer_key; // varchar(191) primary_key not_null not 255 because utf8mb4 takes more space
  26. public $tok; // char(32) primary_key not_null
  27. public $secret; // char(32) not_null
  28. public $type; // tinyint(1) not_null
  29. public $state; // tinyint(1)
  30. public $verifier; // varchar(191) not 255 because utf8mb4 takes more space
  31. public $verified_callback; // varchar(191) not 255 because utf8mb4 takes more space
  32. public $created; // datetime()
  33. public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
  34. /* the code above is auto generated do not remove the tag below */
  35. ###END_AUTOCODE
  36. public static function schemaDef()
  37. {
  38. return array(
  39. 'description' => 'OAuth token record',
  40. 'fields' => array(
  41. 'consumer_key' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'unique identifier, root URL'),
  42. 'tok' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'identifying value'),
  43. 'secret' => array('type' => 'char', 'length' => 32, 'not null' => true, 'description' => 'secret value'),
  44. 'type' => array('type' => 'int', 'size' => 'tiny', 'not null' => true, 'default' => 0, 'description' => 'request or access'),
  45. 'state' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'for requests, 0 = initial, 1 = authorized, 2 = used'),
  46. 'verifier' => array('type' => 'varchar', 'length' => 191, 'description' => 'verifier string for OAuth 1.0a'),
  47. 'verified_callback' => array('type' => 'varchar', 'length' => 191, 'description' => 'verified callback URL for OAuth 1.0a'),
  48. 'created' => array('type' => 'datetime', 'description' => 'date this record was created'),
  49. 'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
  50. ),
  51. 'primary key' => array('consumer_key', 'tok'),
  52. 'foreign keys' => array(
  53. 'token_consumer_key_fkey' => array('consumer', array('consumer_key' => 'consumer_key')),
  54. ),
  55. );
  56. }
  57. }