aboutsummaryrefslogtreecommitdiff
path: root/dbinit.sql
blob: 0b2930ca828f1e1b2ad2e9edd1ef951554adfe26 (plain) (blame)
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
CREATE DATABASE arfnet2;

CREATE TABLE `arfnet2`.`users` (
    `id` INT NOT NULL AUTO_INCREMENT ,
    `username` VARCHAR(31) NOT NULL ,
    `password` VARCHAR(255) NOT NULL ,
    `email` VARCHAR(127) NOT NULL ,
    `verifycode` VARCHAR(31) NOT NULL ,
    `type` ENUM('client','helpdesk','accountant','admin') NOT NULL ,
    `regdate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
    `status` ENUM('verified','unverified') NOT NULL DEFAULT 'unverified' ,
    PRIMARY KEY (`id`)
);

CREATE TABLE `arfnet2`.`services` (
    `id` INT NOT NULL AUTO_INCREMENT ,
    `name` VARCHAR(255) NOT NULL ,
    `type` ENUM('free','standard','premium') NOT NULL ,
    `billing` VARCHAR(255) NOT NULL ,
    `description` TEXT NOT NULL ,
    PRIMARY KEY (`id`)
);

CREATE TABLE `arfnet2`.`orders` (
    `id` INT NOT NULL AUTO_INCREMENT ,
    `service` INT NOT NULL ,
    `name` VARCHAR(255) NOT NULL ,
    `client` INT NOT NULL ,
    `billing` VARCHAR(255) NOT NULL ,
    `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
    `status` ENUM('setting up','active','inactive') NOT NULL DEFAULT 'setting up' ,
    `comments` TEXT NOT NULL ,
    PRIMARY KEY (`id`)
);

CREATE TABLE `arfnet2`.`tickets` (
    `id` INT NOT NULL AUTO_INCREMENT ,
    `order` INT NOT NULL ,
    `subject` VARCHAR(255) NOT NULL ,
    `body` TEXT NOT NULL ,
    `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
    `status` ENUM('open','closed') NOT NULL DEFAULT 'open' ,
    `closecomment` TEXT NOT NULL DEFAULT '',
    `asignee` INT NOT NULL ,
    PRIMARY KEY (`id`)
);

CREATE TABLE `arfnet2`.`invoices` (
    `id` INT NOT NULL AUTO_INCREMENT ,
    `client` INT NOT NULL ,
    `desc` VARCHAR(255) NOT NULL ,
    `amount` DECIMAL(10, 4) NOT NULL ,
    `pdf` MEDIUMBLOB NOT NULL ,
    `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
    `proof` MEDIUMBLOB DEFAULT NULL ,
    `status` ENUM('paid','unpaid') NOT NULL DEFAULT 'unpaid' ,
    PRIMARY KEY (`id`)
);