-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtaxexpress.sql
126 lines (109 loc) · 4.17 KB
/
taxexpress.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
-- MySQL Script generated by MySQL Workbench
-- Tue 26 Feb 2019 17:45:50 WAT
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema taxexpress
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema taxexpress
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `taxexpress` DEFAULT CHARACTER SET utf8 ;
USE `taxexpress` ;
-- -----------------------------------------------------
-- Table `taxexpress`.`admins`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `taxexpress`.`admins` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`username` VARCHAR(64) NULL,
`email` VARCHAR(45) NULL,
`token` VARCHAR(255) NULL,
`password` VARCHAR(255) NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
UNIQUE INDEX `token_UNIQUE` (`token` ASC),
UNIQUE INDEX `email_UNIQUE` (`email` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `taxexpress`.`businesses`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `taxexpress`.`businesses` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NULL,
`rc_number` INT(8) NULL,
`business_desc` VARCHAR(255) NULL,
`email` VARCHAR(45) NOT NULL,
`total_revenue` FLOAT NULL,
`tax_status` INT NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
UNIQUE INDEX `email_UNIQUE` (`email` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `taxexpress`.`tax`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `taxexpress`.`tax` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`business_id` INT(11) UNSIGNED NOT NULL,
`tax_period` DATE NOT NULL,
`revenue` FLOAT NOT NULL,
`tax_paid` FLOAT NOT NULL DEFAULT 0.00,
`date_paid` DATETIME NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
INDEX `fk_tax_1_idx` (`business_id` ASC),
CONSTRAINT `fk_tax_1`
FOREIGN KEY (`business_id`)
REFERENCES `taxexpress`.`businesses` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `taxexpress`.`notifications`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `taxexpress`.`notifications` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`business_id` INT(11) UNSIGNED NOT NULL,
`message` VARCHAR(255) NOT NULL,
`to_business` TINYINT(1) NOT NULL,
`to_authority` TINYINT(1) NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
INDEX `fk_notifications_1_idx` (`business_id` ASC),
CONSTRAINT `fk_notifications_1`
FOREIGN KEY (`business_id`)
REFERENCES `taxexpress`.`businesses` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `taxexpress`.`tax_status`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `taxexpress`.`tax_status` (
`id` INT NOT NULL,
`status` VARCHAR(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `status_UNIQUE` (`status` ASC))
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-- -----------------------------------------------------
-- Data for table `taxexpress`.`tax_status`
-- -----------------------------------------------------
START TRANSACTION;
USE `taxexpress`;
INSERT INTO `taxexpress`.`tax_status` (`id`, `status`) VALUES (1, 'paid');
INSERT INTO `taxexpress`.`tax_status` (`id`, `status`) VALUES (2, 'pending');
COMMIT;