forked from project-error/pefcl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
import.sql
101 lines (85 loc) · 3.35 KB
/
import.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
-- dev.pefcl_accounts definition
CREATE TABLE `pefcl_accounts` (
`id` int NOT NULL AUTO_INCREMENT,
`number` varchar(255) DEFAULT NULL,
`accountName` varchar(255) DEFAULT NULL,
`isDefault` tinyint(1) DEFAULT '0',
`ownerIdentifier` varchar(255) DEFAULT NULL,
`role` varchar(255) DEFAULT 'owner',
`balance` int DEFAULT '25000',
`type` varchar(255) DEFAULT 'personal',
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
`deletedAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `number` (`number`),
UNIQUE KEY `number_2` (`number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- dev.pefcl_cash definition
CREATE TABLE `pefcl_cash` (
`id` int NOT NULL AUTO_INCREMENT,
`amount` int DEFAULT '2000',
`ownerIdentifier` varchar(255) DEFAULT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ownerIdentifier` (`ownerIdentifier`),
UNIQUE KEY `ownerIdentifier_2` (`ownerIdentifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- dev.pefcl_external_accounts definition
CREATE TABLE `pefcl_external_accounts` (
`id` int NOT NULL AUTO_INCREMENT,
`number` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`userId` varchar(255) DEFAULT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `pefcl_external_accounts_user_id_number` (`userId`,`number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- dev.pefcl_invoices definition
CREATE TABLE `pefcl_invoices` (
`id` int NOT NULL AUTO_INCREMENT,
`message` varchar(255) NOT NULL,
`from` varchar(255) NOT NULL,
`to` varchar(255) NOT NULL,
`fromIdentifier` varchar(255) NOT NULL,
`toIdentifier` varchar(255) NOT NULL,
`receiverAccountIdentifier` varchar(255) DEFAULT NULL,
`amount` int DEFAULT '0',
`status` varchar(255) DEFAULT 'PENDING',
`expiresAt` datetime NOT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- dev.pefcl_shared_accounts definition
CREATE TABLE `pefcl_shared_accounts` (
`id` int NOT NULL AUTO_INCREMENT,
`userIdentifier` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`role` varchar(255) DEFAULT 'contributor',
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
`deletedAt` datetime DEFAULT NULL,
`accountId` int DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `accountId` (`accountId`),
CONSTRAINT `pefcl_shared_accounts_ibfk_1` FOREIGN KEY (`accountId`) REFERENCES `pefcl_accounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- dev.pefcl_transactions definition
CREATE TABLE `pefcl_transactions` (
`id` int NOT NULL AUTO_INCREMENT,
`message` varchar(255) DEFAULT NULL,
`amount` int DEFAULT '0',
`type` varchar(255) DEFAULT 'Outgoing',
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL,
`toAccountId` int DEFAULT NULL,
`fromAccountId` int DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `toAccountId` (`toAccountId`),
KEY `fromAccountId` (`fromAccountId`),
CONSTRAINT `pefcl_transactions_ibfk_1` FOREIGN KEY (`toAccountId`) REFERENCES `pefcl_accounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `pefcl_transactions_ibfk_2` FOREIGN KEY (`fromAccountId`) REFERENCES `pefcl_accounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;