-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.sql
106 lines (90 loc) · 4.92 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 8.0.30 - MySQL Community Server - GPL
-- Server OS: Win64
-- HeidiSQL Version: 12.1.0.6537
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-- Dumping database structure for double-entry
CREATE DATABASE IF NOT EXISTS `double-entry` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `double-entry`;
-- Dumping structure for table double-entry.accounts
CREATE TABLE IF NOT EXISTS `accounts` (
`accountId` int NOT NULL AUTO_INCREMENT,
`name` varchar(200) NOT NULL,
`urlName` varchar(200) NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`accountId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table double-entry.accounts: ~0 rows (approximately)
-- Dumping structure for table double-entry.activities
CREATE TABLE IF NOT EXISTS `activities` (
`activityId` int NOT NULL AUTO_INCREMENT,
`userId` int NOT NULL,
`summary` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`detail` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`operation` enum('create','update','delete','other') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`activityId`),
KEY `FK__users` (`userId`),
CONSTRAINT `FK__users` FOREIGN KEY (`userId`) REFERENCES `users` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table double-entry.activities: ~0 rows (approximately)
-- Dumping structure for table double-entry.coa
CREATE TABLE IF NOT EXISTS `coa` (
`coa_id` int NOT NULL AUTO_INCREMENT,
`type` enum('asset','expense','liablitiy','income','capital') NOT NULL,
`accountId` int NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`coa_id`),
UNIQUE KEY `type_accountId` (`type`,`accountId`),
KEY `FK_coa_accounts` (`accountId`),
CONSTRAINT `FK_coa_accounts` FOREIGN KEY (`accountId`) REFERENCES `accounts` (`accountId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table double-entry.coa: ~0 rows (approximately)
-- Dumping structure for table double-entry.transactiondetails
CREATE TABLE IF NOT EXISTS `transactiondetails` (
`transactionDetailId` int NOT NULL AUTO_INCREMENT,
`accountId` int NOT NULL,
`particulars` varchar(200) NOT NULL,
`debit` decimal(13,2) NOT NULL DEFAULT '0.00',
`credit` decimal(13,2) NOT NULL DEFAULT '0.00',
PRIMARY KEY (`transactionDetailId`),
KEY `FK_transactiondetails_accounts` (`accountId`),
CONSTRAINT `FK_transactiondetails_accounts` FOREIGN KEY (`accountId`) REFERENCES `accounts` (`accountId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table double-entry.transactiondetails: ~0 rows (approximately)
-- Dumping structure for table double-entry.transactions
CREATE TABLE IF NOT EXISTS `transactions` (
`transactionId` int NOT NULL AUTO_INCREMENT,
`userId` int NOT NULL,
`title` varchar(300) NOT NULL,
`created` timestamp NOT NULL,
PRIMARY KEY (`transactionId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table double-entry.transactions: ~0 rows (approximately)
-- Dumping structure for table double-entry.users
CREATE TABLE IF NOT EXISTS `users` (
`userId` int NOT NULL AUTO_INCREMENT,
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`email` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`password` char(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`isVerified` tinyint(1) NOT NULL DEFAULT '0',
`pr_token` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`ev_token` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- Dumping data for table double-entry.users: ~0 rows (approximately)
/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;