-
Notifications
You must be signed in to change notification settings - Fork 0
/
Database.sql
85 lines (73 loc) · 2.34 KB
/
Database.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
--
-- DATABASE
--
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
-- --------------------------------------------------------
--
-- Table structure for table `options`
--
CREATE TABLE options (
option_id BIGINT(10) NOT NULL,
option_name varchar(255) NOT NULL,
option_value LONGTEXT,
option_autoload VARCHAR(10) NOT NULL DEFAULT 'no'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Indexes for table `options`
--
ALTER TABLE `options`
ADD PRIMARY KEY (`option_id`),
ADD UNIQUE KEY `option_name` (`option_name`);
--
-- AUTO_INCREMENT for table `options`
--
ALTER TABLE `options`
MODIFY `option_id` BIGINT(11) NOT NULL AUTO_INCREMENT;
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` BIGINT(11) NOT NULL,
`first_name` VARCHAR(64) COLLATE utf8_unicode_ci NOT NULL,
`last_name` VARCHAR(64) COLLATE utf8_unicode_ci NOT NULL,
`username` VARCHAR(64) COLLATE utf8_unicode_ci NOT NULL,
`email` VARCHAR(255) COLLATE utf8_unicode_ci NOT NULL,
`password` VARCHAR(60) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'md5 string PasswordHash - (phpass by openwall)',
`private_key` VARCHAR(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Private Grant token API',
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` TIMESTAMP NULL DEFAULT '1990-01-01 00:00:00' ON UPDATE CURRENT_TIMESTAMP COMMENT 'use `1990-01-01 00:00:00` to prevent error sql time stamp zero value'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `username_email` (`username`,`email`),
ADD KEY `username` (`username`),
ADD KEY `email` (`email`);
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` BIGINT(11) NOT NULL AUTO_INCREMENT;
--
-- Table structure for table `users_meta`
--
CREATE TABLE `users_meta` (
`meta_id` BIGINT(11) NOT NULL,
`meta_user_id` BIGINT(11) NOT NULL,
`meta_name` VARCHAR(255) NOT NULL,
`meta_value` LONGTEXT
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Indexes for table `users_meta`
--
ALTER TABLE `users_meta`
ADD PRIMARY KEY (`meta_id`),
ADD UNIQUE KEY `meta_name_selector` (`meta_name`);
--
-- AUTO_INCREMENT for table `users_meta`
--
ALTER TABLE `users_meta`
MODIFY `meta_id` BIGINT(11) NOT NULL AUTO_INCREMENT;