appidea-restapi/scheme.sql

73 lines
1.8 KiB
SQL

--
-- Database: `app-idea`
--
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` CHAR(32) NOT NULL,
`hashtag` varchar(6) NOT NULL,
`name` varchar(30) NOT NULL,
`email` varchar(255) NOT NULL,
`password` char(60) NOT NULL,
`rank` tinyint(4) DEFAULT 0,
`avatar_url` varchar(255) DEFAULT NULL,
`location` varchar(20) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`language_id` tinyint(4) DEFAULT 0,
`cash` int(11) DEFAULT 0,
`posts` int(11) DEFAULT 0,
`followers` int(11) DEFAULT 0,
`following` int(11) DEFAULT 0,
'state' tinyint(4) DEFAULT 0,
`last_login` datetime DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `pictures`
--
CREATE TABLE `pictures` (
`user_id` CHAR(36) NOT NULL,
`picture_id` int(11) NOT NULL,
`likes` int(11) DEFAULT 0,
`dislikes` int(11) DEFAULT 0,
`location` varchar(20) NOT NULL,
`description` varchar(250) DEFAULT NULL,
`created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `sessions`
--
CREATE TABLE `sessions` (
`user_id` CHAR(32) NOT NULL,
`session_id` CHAR(32) NOT NULL,
`ip` varchar(32) NOT NULL,
`user_agent` varchar(32) NOT NULL,
`last_login` datetime NOT NULL,
`expires` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `user_actions`
--
CREATE TABLE `user_actions` (
`id` char(16) NOT NULL,
`user_id` char(32) NOT NULL,
`expires` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;