· 8 years ago · Feb 17, 2018, 07:22 PM
1SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
2SET time_zone = "+00:00";
3--
4-- Compatible with newer MySQL versions. (After MySQL-5.5)
5-- This SQL uses utf8mb4 and has CURRENT_TIMESTAMP function.
6--
7
8
9/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
10/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
11/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
12/*!40101 SET NAMES utf8mb4 */;
13
14--
15-- Database: `altislife`
16-- Default Schema
17--
18CREATE DATABASE IF NOT EXISTS `altislife` DEFAULT CHARACTER SET utf8mb4;
19USE `altislife`;
20
21--
22-- Drop procedures to ensure no conflicts
23--
24DROP PROCEDURE IF EXISTS `resetLifeVehicles`;
25DROP PROCEDURE IF EXISTS `deleteDeadVehicles`;
26DROP PROCEDURE IF EXISTS `deleteOldHouses`;
27DROP PROCEDURE IF EXISTS `deleteOldGangs`;
28DROP PROCEDURE IF EXISTS `deleteOldContainers`;
29
30DELIMITER $$
31--
32-- Procedures
33-- Edit arma3 to match a user in MySQL
34-- For external databases: Edit localhost to match arma3server IP
35--
36
37CREATE DEFINER=`arma3`@`localhost` PROCEDURE `resetLifeVehicles`()
38BEGIN
39 UPDATE `vehicles` SET `active`= 0;
40END$$
41
42CREATE DEFINER=`arma3`@`localhost` PROCEDURE `deleteDeadVehicles`()
43BEGIN
44 DELETE FROM `vehicles` WHERE `alive` = 0;
45END$$
46
47CREATE DEFINER=`arma3`@`localhost` PROCEDURE `deleteOldHouses`()
48BEGIN
49 DELETE FROM `houses` WHERE `owned` = 0;
50END$$
51
52CREATE DEFINER=`arma3`@`localhost` PROCEDURE `deleteOldGangs`()
53BEGIN
54 DELETE FROM `gangs` WHERE `active` = 0;
55END$$
56
57CREATE DEFINER=`arma3`@`localhost` PROCEDURE `deleteOldContainers`()
58BEGIN
59 DELETE FROM `containers` WHERE `owned` = 0;
60END$$
61
62DELIMITER ;
63
64-- --------------------------------------------------------
65
66--
67-- Table structure for table `players`
68--
69
70CREATE TABLE IF NOT EXISTS `players` (
71 `uid` int(12) NOT NULL AUTO_INCREMENT,
72 `name` varchar(32) NOT NULL,
73 `aliases` text NOT NULL,
74 `playerid` varchar(64) NOT NULL,
75 `cash` int(100) NOT NULL DEFAULT '0',
76 `bankacc` int(100) NOT NULL DEFAULT '0',
77 `coplevel` enum('0','1','2','3','4','5','6','7') NOT NULL DEFAULT '0',
78 `mediclevel` enum('0','1','2','3','4','5') NOT NULL DEFAULT '0',
79 `civ_licenses` text NOT NULL,
80 `cop_licenses` text NOT NULL,
81 `med_licenses` text NOT NULL,
82 `civ_gear` text NOT NULL,
83 `cop_gear` text NOT NULL,
84 `med_gear` text NOT NULL,
85 `civ_stats` varchar(32) NOT NULL DEFAULT '"[100,100,0]"',
86 `cop_stats` varchar(32) NOT NULL DEFAULT '"[100,100,0]"',
87 `med_stats` varchar(32) NOT NULL DEFAULT '"[100,100,0]"',
88 `arrested` tinyint(1) NOT NULL DEFAULT '0',
89 `adminlevel` enum('0','1','2','3','4','5') NOT NULL DEFAULT '0',
90 `donorlevel` enum('0','1','2','3','4','5') NOT NULL DEFAULT '0',
91 `blacklist` tinyint(1) NOT NULL DEFAULT '0',
92 `civ_alive` tinyint(1) NOT NULL DEFAULT '0',
93 `civ_position` varchar(64) NOT NULL DEFAULT '"[]"',
94 `playtime` varchar(32) NOT NULL DEFAULT '"[0,0,0]"',
95 `insert_time` timestamp DEFAULT CURRENT_TIMESTAMP,
96 `last_seen` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
97 PRIMARY KEY (`uid`),
98 UNIQUE KEY `playerid` (`playerid`),
99 KEY `name` (`name`),
100 KEY `blacklist` (`blacklist`)
101) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=12 ;
102
103-- --------------------------------------------------------
104
105--
106-- Table structure for table `vehicles`
107--
108
109CREATE TABLE IF NOT EXISTS `vehicles` (
110 `id` int(12) NOT NULL AUTO_INCREMENT,
111 `side` varchar(16) NOT NULL,
112 `classname` varchar(64) NOT NULL,
113 `type` varchar(16) NOT NULL,
114 `pid` varchar(32) NOT NULL,
115 `alive` tinyint(1) NOT NULL DEFAULT '1',
116 `blacklist` tinyint(1) NOT NULL DEFAULT '0',
117 `active` tinyint(1) NOT NULL DEFAULT '0',
118 `plate` int(20) NOT NULL,
119 `color` int(20) NOT NULL,
120 `inventory` text NOT NULL,
121 `gear` text NOT NULL,
122 `fuel` double NOT NULL DEFAULT '1',
123 `damage` varchar(256) NOT NULL,
124 `insert_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
125 PRIMARY KEY (`id`),
126 KEY `side` (`side`),
127 KEY `pid` (`pid`),
128 KEY `type` (`type`)
129) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=2 ;
130
131-- --------------------------------------------------------
132
133--
134-- Table structure for table `houses`
135-- Needed for extDB latest update on git
136--
137
138CREATE TABLE IF NOT EXISTS `houses` (
139 `id` int(11) NOT NULL AUTO_INCREMENT,
140 `pid` varchar(32) NOT NULL,
141 `pos` varchar(64) DEFAULT NULL,
142 `owned` tinyint(1) DEFAULT '0',
143 `insert_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
144 PRIMARY KEY (`id`,`pid`)
145) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=4 ;
146
147-- --------------------------------------------------------
148
149--
150-- Table structure for table `gangs`
151-- Needed for extDB latest update on git
152--
153
154CREATE TABLE IF NOT EXISTS `gangs` (
155 `id` int(11) NOT NULL AUTO_INCREMENT,
156 `owner` varchar(32) DEFAULT NULL,
157 `name` varchar(32) DEFAULT NULL,
158 `members` text,
159 `maxmembers` int(3) DEFAULT '8',
160 `bank` int(100) DEFAULT '0',
161 `active` tinyint(1) DEFAULT '1',
162 `insert_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
163 PRIMARY KEY (`id`),
164 UNIQUE KEY `name_UNIQUE` (`name`)
165) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
166
167-- --------------------------------------------------------
168
169--
170-- Table structure for table `containers`
171-- Needed for extDB latest update on git
172--
173
174CREATE TABLE IF NOT EXISTS `containers` (
175 `id` int(11) NOT NULL AUTO_INCREMENT,
176 `pid` varchar(32) NOT NULL,
177 `classname` varchar(32) NOT NULL,
178 `pos` varchar(64) DEFAULT NULL,
179 `inventory` text NOT NULL,
180 `gear` text NOT NULL,
181 `dir` varchar(128) DEFAULT NULL,
182 `active` tinyint(1) NOT NULL DEFAULT '0',
183 `owned` tinyint(1) DEFAULT '0',
184 `insert_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
185 PRIMARY KEY (`id`,`pid`)
186) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=4;
187
188-- --------------------------------------------------------
189
190--
191-- Table structure for table `wanted`
192-- Needed for extDB latest update on git
193--
194
195CREATE TABLE IF NOT EXISTS `wanted` (
196 `wantedID` varchar(64) NOT NULL,
197 `wantedName` varchar(32) NOT NULL,
198 `wantedCrimes` text NOT NULL,
199 `wantedBounty` int(100) NOT NULL,
200 `active` tinyint(1) NOT NULL DEFAULT '0',
201 `insert_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
202 PRIMARY KEY (`wantedID`)
203) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
204
205-- --------------------------------------------------------
206
207/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
208/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
209/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;