Browse Source

add schema

pull/10/head
Aaron Parecki 4 years ago
parent
commit
83444029fa
No known key found for this signature in database GPG Key ID: 276C2817346D6056
1 changed files with 41 additions and 0 deletions
  1. +41
    -0
      schema/schema.sql

+ 41
- 0
schema/schema.sql View File

@ -0,0 +1,41 @@
CREATE TABLE `users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`type` enum('micropub','local') NOT NULL,
`url` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`photo_url` varchar(255) DEFAULT NULL,
`authorization_endpoint` varchar(255) DEFAULT NULL,
`token_endpoint` varchar(255) DEFAULT NULL,
`micropub_endpoint` varchar(255) DEFAULT NULL,
`micropub_media_endpoint` varchar(255) NOT NULL DEFAULT '',
`access_token` text,
`token_scope` varchar(255) DEFAULT NULL,
`token_response` text,
`micropub_success` tinyint(4) DEFAULT '0',
`location_enabled` tinyint(4) NOT NULL DEFAULT '0',
`date_created` datetime DEFAULT NULL,
`last_login` datetime DEFAULT NULL,
`enable_array_micropub` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `entries` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`published` datetime DEFAULT NULL,
`timezone` varchar(255) DEFAULT NULL,
`tz_offset` int(11) DEFAULT NULL,
`latitude` double DEFAULT NULL,
`longitude` double DEFAULT NULL,
`type` enum('eat','drink') DEFAULT NULL,
`content` text,
`canonical_url` varchar(255) DEFAULT NULL,
`photo_url` varchar(255) NOT NULL DEFAULT '',
`micropub_success` tinyint(4) DEFAULT NULL,
`micropub_response` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE FUNCTION `gc_distance`(lat1 DOUBLE, lng1 DOUBLE, lat2 DOUBLE, lng2 DOUBLE) RETURNS double DETERMINISTIC
RETURN ( 6378100 * ACOS( COS( RADIANS(lat1) ) * COS( RADIANS(lat2) ) * COS( RADIANS(lng2) - RADIANS(lng1) ) + SIN( RADIANS(lat1) ) * SIN( RADIANS(lat2) ) ) );

Loading…
Cancel
Save