-
Notifications
You must be signed in to change notification settings - Fork 1
/
databaseSetup.sql
56 lines (52 loc) · 1.42 KB
/
databaseSetup.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
CREATE TABLE UserInfo
(
id INT NOT NULL AUTO_INCREMENT,
username VARCHAR(200) NOT NULL,
password VARCHAR(200) NOT NULL,
currency VARCHAR(200) NOT NULL DEFAULT 'EUR',
ThemeColor VARCHAR(200) NOT NULL DEFAULT '#85bb65',
Age INT,
Language VARCHAR(200) NOT NULL DEFAULT 'en_GB',
PRIMARY KEY (id)
);
CREATE TABLE Incomes
(
IncomeID INT NOT NULL AUTO_INCREMENT,
Type VARCHAR(200) NOT NULL,
Amount DOUBLE NOT NULL,
Amount_Minus_Taxes DOUBLE NOT NULL,
Currency VARCHAR(200) NOT NULL DEFAULT 'EUR',
SalaryDate DATE NOT NULL,
Taxrate DOUBLE NOT NULL,
UserID INT NOT NULL,
PRIMARY KEY (IncomeID),
FOREIGN KEY (UserID) REFERENCES Registration(id)
);
CREATE TABLE Constantexpenses
(
ConstanexpenseId INT NOT NULL AUTO_INCREMENT,
Title VARCHAR(200) NOT NULL,
Amount DOUBLE NOT NULL,
registration_id INT NOT NULL,
PRIMARY KEY (ConstanexpenseId),
FOREIGN KEY (registration_id) REFERENCES Registration(id)
);
CREATE TABLE Budgets
(
BudgetId INT NOT NULL AUTO_INCREMENT,
BudgetName VARCHAR(200) NOT NULL,
Money DOUBLE NOT NULL,
registration_id INT NOT NULL,
PRIMARY KEY (BudgetId),
FOREIGN KEY (registration_id) REFERENCES Registration(id)
);
CREATE TABLE Expenses
(
ExpenseId INT NOT NULL AUTO_INCREMENT,
ExpenseType VARCHAR(200) NOT NULL,
Money DOUBLE NOT NULL,
BudgetId INT NOT NULL,
ExpenseDate INT NOT NULL,
PRIMARY KEY (ExpenseId),
FOREIGN KEY (BudgetId) REFERENCES Budgets(BudgetId)
);