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.

41 lines
1.6 KiB

4 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. PRIMARY KEY (`id`)
  20. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  21. CREATE TABLE `entries` (
  22. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  23. `user_id` int(11) DEFAULT NULL,
  24. `published` datetime DEFAULT NULL,
  25. `timezone` varchar(255) DEFAULT NULL,
  26. `tz_offset` int(11) DEFAULT NULL,
  27. `latitude` double DEFAULT NULL,
  28. `longitude` double DEFAULT NULL,
  29. `type` enum('eat','drink') DEFAULT NULL,
  30. `content` text,
  31. `canonical_url` varchar(255) DEFAULT NULL,
  32. `photo_url` varchar(255) NOT NULL DEFAULT '',
  33. `micropub_success` tinyint(4) DEFAULT NULL,
  34. `micropub_response` text,
  35. PRIMARY KEY (`id`)
  36. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  37. CREATE FUNCTION `gc_distance`(lat1 DOUBLE, lng1 DOUBLE, lat2 DOUBLE, lng2 DOUBLE) RETURNS double DETERMINISTIC
  38. RETURN ( 6378100 * ACOS( COS( RADIANS(lat1) ) * COS( RADIANS(lat2) ) * COS( RADIANS(lng2) - RADIANS(lng1) ) + SIN( RADIANS(lat1) ) * SIN( RADIANS(lat2) ) ) );