-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
database.sql
35 lines (32 loc) · 1.23 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
--
-- Copyright: (c) 2017-2022, Pierre-Henry Soria. All Rights Reserved.
-- License: GNU General Public License <https://www.gnu.org/licenses/gpl-3.0.en.html>
--
CREATE TABLE user (
userId int(11) unsigned NOT NULL AUTO_INCREMENT,
hash varchar(40) NOT NULL,
email varchar(120) NOT NULL,
password varchar(120) NOT NULL,
fullname varchar(250) DEFAULT NULL,
isTwoFactorAuth enum('1','0') DEFAULT '0',
twoFactorAuthSecret varchar(40) DEFAULT NULL,
ip varchar(45) NOT NULL DEFAULT '127.0.0.1',
registrationDate datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY (hash),
UNIQUE KEY (email),
PRIMARY KEY (userId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE payment (
userId int(11) unsigned NOT NULL,
paymentGateway enum('stripe','paypal') NOT NULL DEFAULT 'stripe',
publishableKey varchar(40) DEFAULT NULL,
secretKey varchar(40) DEFAULT NULL,
paypalEmail varchar(120) NOT NULL,
businessName varchar(100) NOT NULL,
itemName varchar(100) NOT NULL,
currency char(3) NOT NULL DEFAULT 'USD',
amount decimal(8, 2) NOT NULL DEFAULT '0.00',
isBitcoin tinyint(1) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (userId),
FOREIGN KEY (userId) REFERENCES user(userId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;