You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.7 KiB

7 years ago
7 years ago
  1. CREATE TABLE `users` (
  2. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  3. `type` enum('micropub','local') NOT NULL,
  4. `url` varchar(255) DEFAULT NULL,
  5. `name` varchar(255) DEFAULT NULL,
  6. `photo_url` varchar(255) DEFAULT NULL,
  7. `authorization_endpoint` varchar(255) DEFAULT NULL,
  8. `token_endpoint` varchar(255) DEFAULT NULL,
  9. `micropub_endpoint` varchar(255) DEFAULT NULL,
  10. `micropub_media_endpoint` varchar(255) NOT NULL DEFAULT '',
  11. `access_token` text,
  12. `token_scope` varchar(255) DEFAULT NULL,
  13. `token_response` text,
  14. `micropub_success` tinyint(4) DEFAULT '0',
  15. `location_enabled` tinyint(4) NOT NULL DEFAULT '0',
  16. `date_created` datetime DEFAULT NULL,
  17. `last_login` datetime DEFAULT NULL,
  18. `enable_array_micropub` tinyint(4) NOT NULL DEFAULT '1',
  19. `device_code` varchar(10) DEFAULT NULL,
  20. `device_code_expires` datetime DEFAULT NULL,
  21. PRIMARY KEY (`id`)
  22. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  23. CREATE TABLE `entries` (
  24. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  25. `user_id` int(11) DEFAULT NULL,
  26. `published` datetime DEFAULT NULL,
  27. `timezone` varchar(255) DEFAULT NULL,
  28. `tz_offset` int(11) DEFAULT NULL,
  29. `latitude` double DEFAULT NULL,
  30. `longitude` double DEFAULT NULL,
  31. `type` enum('eat','drink') DEFAULT NULL,
  32. `content` text,
  33. `canonical_url` varchar(255) DEFAULT NULL,
  34. `photo_url` varchar(255) NOT NULL DEFAULT '',
  35. `micropub_success` tinyint(4) DEFAULT NULL,
  36. `micropub_response` text,
  37. PRIMARY KEY (`id`)
  38. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  39. CREATE FUNCTION `gc_distance`(lat1 DOUBLE, lng1 DOUBLE, lat2 DOUBLE, lng2 DOUBLE) RETURNS double DETERMINISTIC
  40. RETURN ( 6378100 * ACOS( COS( RADIANS(lat1) ) * COS( RADIANS(lat2) ) * COS( RADIANS(lng2) - RADIANS(lng1) ) + SIN( RADIANS(lat1) ) * SIN( RADIANS(lat2) ) ) );