Skip to content

Commit c8214da

Browse files
committed
Update DB install script
1 parent 3b16571 commit c8214da

File tree

1 file changed

+130
-106
lines changed

1 file changed

+130
-106
lines changed

install/db.sql

Lines changed: 130 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,134 @@
1-
CREATE TABLE IF NOT EXISTS `aircraft` (
1+
CREATE TABLE `aircraft` (
22
`id` int(11) NOT NULL AUTO_INCREMENT,
33
`name` text NOT NULL,
44
`ifaircraftid` text NOT NULL,
55
`liveryname` text DEFAULT NULL,
66
`ifliveryid` text DEFAULT NULL,
7-
`notes` VARCHAR(12),
8-
`rankreq` int(11) NOT NULL DEFAULT '1',
9-
`status` int(11) NOT NULL DEFAULT '0',
7+
`notes` varchar(12) DEFAULT NULL,
8+
`rankreq` int(11) DEFAULT NULL,
9+
`awardreq` int(11) DEFAULT NULL,
10+
`status` int(11) NOT NULL DEFAULT 0,
1011
PRIMARY KEY (`id`)
11-
);
12+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
1213

13-
CREATE TABLE IF NOT EXISTS `news` (
14+
CREATE TABLE `awards` (
15+
`id` int(11) NOT NULL AUTO_INCREMENT,
16+
`name` text NOT NULL,
17+
`description` text NOT NULL,
18+
`imageurl` text NOT NULL,
19+
PRIMARY KEY (`id`)
20+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
21+
22+
CREATE TABLE `awards_granted` (
23+
`id` int(11) NOT NULL AUTO_INCREMENT,
24+
`awardid` int(11) NOT NULL,
25+
`pilotid` int(11) NOT NULL,
26+
`dateawarded` date NOT NULL,
27+
PRIMARY KEY (`id`)
28+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
29+
30+
CREATE TABLE `cache` (
31+
`name` varchar(120) NOT NULL,
32+
`value` text NOT NULL,
33+
`expiry` datetime DEFAULT NULL,
34+
PRIMARY KEY (`name`)
35+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
36+
37+
CREATE TABLE `hub_changes` (
38+
`id` int(11) NOT NULL AUTO_INCREMENT,
39+
`pilotId` int(11) NOT NULL,
40+
`before` varchar(4) NOT NULL,
41+
`after` varchar(4) NOT NULL,
42+
`status` int(11) NOT NULL DEFAULT 0,
43+
PRIMARY KEY (`id`)
44+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
45+
46+
CREATE TABLE `leave_absence` (
47+
`id` int(11) NOT NULL AUTO_INCREMENT,
48+
`pilotid` int(11) NOT NULL,
49+
`fromdate` date NOT NULL,
50+
`todate` date NOT NULL,
51+
`reason` text NOT NULL,
52+
`status` int(11) DEFAULT 0,
53+
PRIMARY KEY (`id`)
54+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
55+
56+
CREATE TABLE `multipliers` (
57+
`id` int(11) NOT NULL AUTO_INCREMENT,
58+
`code` int(11) NOT NULL,
59+
`multiplier` double NOT NULL,
60+
`name` varchar(120) NOT NULL,
61+
`minrankid` int(11) DEFAULT NULL,
62+
PRIMARY KEY (`id`)
63+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
64+
65+
CREATE TABLE `news` (
1466
`id` int(11) NOT NULL AUTO_INCREMENT,
1567
`subject` text NOT NULL,
1668
`content` text NOT NULL,
1769
`author` text NOT NULL,
18-
`dateposted` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
19-
`status` int(11) NOT NULL DEFAULT '1',
70+
`dateposted` datetime NOT NULL DEFAULT current_timestamp(),
71+
`status` int(11) NOT NULL DEFAULT 1,
2072
PRIMARY KEY (`id`)
21-
);
73+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
2274

23-
INSERT INTO `news` (`subject`, `content`, `author`) VALUES
24-
('Welcome to Flare!', 'Thank You for installing Flare, the Crew Center made for Infinite Flight and integrated with VANet. Before you get your pilots set up with Flare, here are some things to keep in mind.\r\n\r\nFirst of all, if it\'s you\'re not a fan of the orange (kudos if you get the reference), you can change the color theme in site settings.\r\nNext, it\'s worth keeping in mind you can add transfer hours and transfer flights to your pilots. This means you can bring over hours and the number of PIREPs a pilot has filed from another Crew Center. This can be done in the admin panel.\r\nFinally, if you\'re confused with Flare at all check out the tutorials available at https://vanet.app/tutorials.\r\n\r\nEnjoy!', 'Flare Installer');
75+
CREATE TABLE `notifications` (
76+
`id` int(11) NOT NULL AUTO_INCREMENT,
77+
`pilotid` int(11) NOT NULL,
78+
`icon` varchar(20) NOT NULL,
79+
`subject` varchar(20) NOT NULL,
80+
`content` varchar(60) NOT NULL,
81+
`datetime` datetime NOT NULL DEFAULT current_timestamp(),
82+
PRIMARY KEY (`id`)
83+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
84+
85+
CREATE TABLE `options` (
86+
`name` varchar(120) NOT NULL,
87+
`value` text NOT NULL,
88+
PRIMARY KEY (`name`)
89+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
90+
91+
CREATE TABLE `permissions` (
92+
`id` int(11) NOT NULL AUTO_INCREMENT,
93+
`name` varchar(120) NOT NULL,
94+
`userid` int(11) NOT NULL,
95+
PRIMARY KEY (`id`)
96+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2597

26-
CREATE TABLE IF NOT EXISTS `pilots` (
98+
CREATE TABLE `pilots` (
2799
`id` int(11) NOT NULL AUTO_INCREMENT,
28100
`callsign` varchar(120) NOT NULL,
29101
`name` text NOT NULL,
30102
`ifc` text NOT NULL,
31103
`ifuserid` varchar(36) DEFAULT NULL,
32104
`email` text NOT NULL,
33105
`password` text NOT NULL,
34-
`transhours` int(11) NOT NULL DEFAULT '0',
35-
`transflights` int(11) NOT NULL DEFAULT '0',
106+
`transhours` int(11) NOT NULL DEFAULT 0,
107+
`transflights` int(11) NOT NULL DEFAULT 0,
36108
`violand` double DEFAULT NULL,
37109
`grade` int(11) DEFAULT NULL,
38110
`notes` varchar(1200) NOT NULL DEFAULT '',
39-
`status` int(3) NOT NULL DEFAULT '0',
40-
`joined` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
111+
`status` int(11) NOT NULL DEFAULT 0,
112+
`joined` datetime NOT NULL DEFAULT current_timestamp(),
113+
`vanet_id` text DEFAULT NULL,
114+
`vanet_accesstoken` text DEFAULT NULL,
115+
`vanet_refreshtoken` text DEFAULT NULL,
116+
`vanet_expiry` datetime DEFAULT NULL,
117+
`vanet_memberid` text DEFAULT NULL,
41118
PRIMARY KEY (`id`)
42-
);
119+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
43120

44-
CREATE TABLE IF NOT EXISTS `permissions` (
45-
`id` int NOT NULL AUTO_INCREMENT,
46-
`name` text NOT NULL,
47-
`userid` int NOT NULL,
121+
CREATE TABLE `pilot_hubs` (
122+
`id` int(11) NOT NULL AUTO_INCREMENT,
123+
`pilotId` int(11) NOT NULL,
124+
`hub` varchar(4) NOT NULL,
125+
`isCaptain` tinyint(1) NOT NULL DEFAULT 0,
48126
PRIMARY KEY (`id`)
49-
);
127+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
50128

51-
CREATE TABLE IF NOT EXISTS `pireps` (
129+
CREATE TABLE `pireps` (
52130
`id` int(11) NOT NULL AUTO_INCREMENT,
53-
`flightnum` TEXT NOT NULL,
131+
`flightnum` text DEFAULT NULL,
54132
`departure` varchar(4) NOT NULL,
55133
`arrival` varchar(4) NOT NULL,
56134
`flighttime` int(11) NOT NULL,
@@ -59,106 +137,52 @@ CREATE TABLE IF NOT EXISTS `pireps` (
59137
`aircraftid` int(11) NOT NULL,
60138
`fuelused` int(11) NOT NULL,
61139
`multi` text NOT NULL,
62-
`status` int(11) DEFAULT '0',
140+
`status` int(11) DEFAULT 0,
63141
PRIMARY KEY (`id`)
64-
);
142+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
65143

66-
CREATE TABLE IF NOT EXISTS `ranks` (
144+
CREATE TABLE `pireps_comments` (
145+
`id` int(11) NOT NULL AUTO_INCREMENT,
146+
`pirepid` int(11) NOT NULL,
147+
`userid` int(11) NOT NULL,
148+
`content` text NOT NULL,
149+
`dateposted` datetime NOT NULL DEFAULT current_timestamp(),
150+
PRIMARY KEY (`id`)
151+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
152+
153+
CREATE TABLE `ranks` (
67154
`id` int(11) NOT NULL AUTO_INCREMENT,
68155
`name` varchar(120) NOT NULL,
69156
`timereq` int(11) NOT NULL,
70157
PRIMARY KEY (`id`)
71-
);
158+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
72159

73-
INSERT INTO `ranks` (`name`, `timereq`) VALUES
74-
('Cadet', 0);
75-
76-
INSERT INTO `ranks` (`name`, `timereq`) VALUES
77-
('Second Officer', 25);
78-
79-
CREATE TABLE IF NOT EXISTS `routes` (
160+
CREATE TABLE `routes` (
80161
`id` int(11) NOT NULL AUTO_INCREMENT,
81-
`fltnum` TEXT NOT NULL,
162+
`fltnum` text DEFAULT NULL,
82163
`dep` varchar(4) NOT NULL,
83164
`arr` varchar(4) NOT NULL,
84165
`duration` int(11) NOT NULL,
85-
`notes` text NULL DEFAULT NULL,
86-
PRIMARY KEY (`id`)
87-
);
88-
89-
CREATE TABLE IF NOT EXISTS `route_aircraft` (
90-
`id` INT NOT NULL AUTO_INCREMENT,
91-
`routeid` INT NOT NULL,
92-
`aircraftid` INT NOT NULL,
93-
PRIMARY KEY (`id`)
94-
);
95-
96-
CREATE TABLE IF NOT EXISTS `notifications` (
97-
`id` INT NOT NULL AUTO_INCREMENT,
98-
`pilotid` INT NOT NULL,
99-
`icon` VARCHAR(20) NOT NULL,
100-
`subject` VARCHAR(20) NOT NULL,
101-
`content` VARCHAR(60) NOT NULL,
102-
`datetime` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
166+
`notes` text DEFAULT NULL,
103167
PRIMARY KEY (`id`)
104-
);
168+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
105169

106-
CREATE TABLE IF NOT EXISTS `multipliers` (
170+
CREATE TABLE `route_aircraft` (
107171
`id` int(11) NOT NULL AUTO_INCREMENT,
108-
`code` int(11) NOT NULL,
109-
`multiplier` double NOT NULL,
110-
`name` varchar(120) NOT NULL,
111-
PRIMARY KEY (`id`),
112-
UNIQUE KEY `code` (`code`)
113-
);
172+
`routeid` int(11) NOT NULL,
173+
`aircraftid` int(11) NOT NULL,
174+
PRIMARY KEY (`id`)
175+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
114176

115-
CREATE TABLE IF NOT EXISTS `options` (
116-
`name` varchar(120) NOT NULL,
117-
`value` text NOT NULL,
118-
PRIMARY KEY (`name`)
119-
);
120-
121-
CREATE TABLE IF NOT EXISTS `notifications` (
122-
`id` INT NOT NULL AUTO_INCREMENT,
123-
`pilotid` INT NOT NULL,
124-
`icon` VARCHAR(20) NOT NULL,
125-
`subject` VARCHAR(20) NOT NULL,
126-
`content` VARCHAR(60) NOT NULL,
127-
`datetime` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
128-
PRIMARY KEY (`id`)
129-
);
130-
131-
CREATE TABLE IF NOT EXISTS `cache` (
132-
`name` VARCHAR(120) NOT NULL,
133-
`value` TEXT NOT NULL,
134-
`expiry` DATETIME NULL,
135-
PRIMARY KEY (`name`)
136-
);
137177

138-
CREATE TABLE IF NOT EXISTS `awards` (
139-
`id` INT NOT NULL AUTO_INCREMENT,
140-
`name` TEXT NOT NULL,
141-
`description` TEXT NOT NULL,
142-
`imageurl` TEXT NOT NULL,
143-
PRIMARY KEY (`id`)
144-
);
178+
INSERT INTO `news` (`subject`, `content`, `author`) VALUES
179+
('Welcome to Flare!', 'Thank You for installing Flare, the Crew Center made for Infinite Flight and integrated with VANet. Before you get your pilots set up with Flare, here are some things to keep in mind.\r\n\r\nFirst of all, if it\'s you\'re not a fan of the orange (kudos if you get the reference), you can change the color theme in site settings.\r\nNext, it\'s worth keeping in mind you can add transfer hours and transfer flights to your pilots. This means you can bring over hours and the number of PIREPs a pilot has filed from another Crew Center. This can be done in the admin panel.\r\nFinally, if you\'re confused with Flare at all check out the tutorials available at https://vanet.app/tutorials.\r\n\r\nEnjoy!', 'Flare Installer');
145180

146-
CREATE TABLE IF NOT EXISTS `awards_granted` (
147-
`id` INT NOT NULL AUTO_INCREMENT,
148-
`awardid` INT NOT NULL,
149-
`pilotid` INT NOT NULL,
150-
`dateawarded` DATE NOT NULL,
151-
PRIMARY KEY (`id`)
152-
);
181+
INSERT INTO `ranks` (`name`, `timereq`) VALUES
182+
('Cadet', 0);
153183

154-
CREATE TABLE IF NOT EXISTS `pireps_comments` (
155-
`id` INT NOT NULL AUTO_INCREMENT,
156-
`pirepid` INT NOT NULL,
157-
`userid` INT NOT NULL,
158-
`content` TEXT NOT NULL,
159-
`dateposted` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
160-
PRIMARY KEY (`id`)
161-
);
184+
INSERT INTO `ranks` (`name`, `timereq`) VALUES
185+
('Second Officer', 25);
162186

163187
INSERT INTO `options` (`name`, `value`) VALUES ('FORCE_SERVER', '0');
164188
INSERT INTO `options` (`name`, `value`) VALUES ('CHECK_PRERELEASE', '0');

0 commit comments

Comments
 (0)