Skip to content

Commit

Permalink
refactor: load sql files separately (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
D4isDAVID authored Sep 26, 2024
1 parent c657990 commit d303852
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 259 deletions.
8 changes: 8 additions & 0 deletions qbox-lean.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,17 @@ tasks:
- action: unzip
dest: ./resources/[qbx]
src: ./tmp/qbx_core.zip
- action: query_database
file: ./resources/[qbx]/qbx_core/qbx_core.sql

- action: download_file
path: ./tmp/qbx_vehicles.zip
url: https://github.com/qbox-project/qbx_vehicles/releases/latest/download/qbx_vehicles.zip
- action: unzip
dest: ./resources/[qbx]
src: ./tmp/qbx_vehicles.zip
- action: query_database
file: ./resources/[qbx]/qbx_vehicles/vehicles.sql

- action: download_github
dest: ./resources/[qbx]/qbx_scoreboard
Expand All @@ -170,6 +174,8 @@ tasks:
dest: ./resources/[qbx]/qbx_vehicleshop
ref: main
src: https://github.com/qbox-project/qbx_vehicleshop
- action: query_database
file: ./resources/[qbx]/qbx_vehicleshop/vehshop.sql

- action: download_github
dest: ./resources/[qbx]/qbx_hud
Expand All @@ -187,6 +193,8 @@ tasks:
- action: unzip
dest: ./resources/[qbx]
src: ./tmp/qbx_management.zip
- action: query_database
file: ./resources/[qbx]/qbx_management/qbx_management.sql

- action: download_file
path: ./tmp/qbx_garages.zip
Expand Down
20 changes: 13 additions & 7 deletions qbox-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,26 @@ tasks:
- action: unzip
dest: ./resources/[qbx]
src: ./tmp/qbx_core.zip
- action: query_database
file: ./resources/[qbx]/qbx_core/qbx_core.sql

- action: download_file
path: ./tmp/qbx_vehicles.zip
url: https://github.com/qbox-project/qbx_vehicles/releases/latest/download/qbx_vehicles.zip
- action: unzip
dest: ./resources/[qbx]
src: ./tmp/qbx_vehicles.zip
- action: query_database
file: ./resources/[qbx]/qbx_vehicles/vehicles.sql

- action: download_file
path: ./tmp/qbx_management.zip
url: https://github.com/qbox-project/qbx_management/releases/latest/download/qbx_management.zip
- action: unzip
dest: ./resources/[qbx]
src: ./tmp/qbx_management.zip
- action: query_database
file: ./resources/[qbx]/qbx_management/qbx_management.sql

- action: download_file
path: ./tmp/qbx_diving.zip
Expand Down Expand Up @@ -201,13 +214,6 @@ tasks:
dest: ./resources/[standalone]
src: ./tmp/vehiclehandler.zip

- action: download_file
path: ./tmp/qbx_vehicles.zip
url: https://github.com/qbox-project/qbx_vehicles/releases/latest/download/qbx_vehicles.zip
- action: unzip
dest: ./resources/[qbx]
src: ./tmp/qbx_vehicles.zip

- action: download_file
path: ./tmp/qbx_garages.zip
url: https://github.com/qbox-project/qbx_garages/releases/latest/download/qbx_garages.zip
Expand Down
245 changes: 0 additions & 245 deletions qbox.sql
Original file line number Diff line number Diff line change
@@ -1,106 +1,3 @@
CREATE TABLE IF NOT EXISTS `apartments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`type` varchar(255) DEFAULT NULL,
`label` varchar(255) DEFAULT NULL,
`citizenid` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `citizenid` (`citizenid`),
KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `bans` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`license` varchar(50) DEFAULT NULL,
`discord` varchar(50) DEFAULT NULL,
`ip` varchar(50) DEFAULT NULL,
`reason` text DEFAULT NULL,
`expire` int(11) DEFAULT NULL,
`bannedby` varchar(255) NOT NULL DEFAULT 'LeBanhammer',
PRIMARY KEY (`id`),
KEY `license` (`license`),
KEY `discord` (`discord`),
KEY `ip` (`ip`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `dealers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '0',
`coords` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`time` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`createdby` varchar(50) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `houselocations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`label` varchar(255) DEFAULT NULL,
`coords` text DEFAULT NULL,
`owned` tinyint(1) DEFAULT NULL,
`price` int(11) DEFAULT NULL,
`tier` tinyint(4) DEFAULT NULL,
`garage` text DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `player_houses` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`house` varchar(50) NOT NULL,
`identifier` varchar(50) DEFAULT NULL,
`citizenid` varchar(50) DEFAULT NULL,
`keyholders` text DEFAULT NULL,
`decorations` text DEFAULT NULL,
`stash` text DEFAULT NULL,
`outfit` text DEFAULT NULL,
`logout` text DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `house` (`house`),
KEY `citizenid` (`citizenid`),
KEY `identifier` (`identifier`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `house_plants` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`building` varchar(30) NOT NULL,
`stage` varchar(11) NOT NULL DEFAULT 'stage1',
`sort` varchar(30) NOT NULL,
`gender` enum('male', 'female') NOT NULL,
`food` tinyint NOT NULL DEFAULT 100,
`health` tinyint NOT NULL DEFAULT 100,
`progress` tinyint NOT NULL DEFAULT 0,
`coords` tinytext NOT NULL,
PRIMARY KEY (`id`),
KEY `building` (`building`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `lapraces` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`checkpoints` text DEFAULT NULL,
`records` text DEFAULT NULL,
`creator` varchar(50) DEFAULT NULL,
`distance` int(11) DEFAULT NULL,
`raceid` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `raceid` (`raceid`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `occasion_vehicles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`seller` varchar(50) DEFAULT NULL,
`price` int(11) DEFAULT NULL,
`description` longtext DEFAULT NULL,
`plate` varchar(50) DEFAULT NULL,
`model` varchar(50) DEFAULT NULL,
`mods` text DEFAULT NULL,
`occasionid` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `occasionId` (`occasionid`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `player_mails` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`citizenid` varchar(50) DEFAULT NULL,
Expand All @@ -115,31 +12,6 @@ CREATE TABLE IF NOT EXISTS `player_mails` (
KEY `citizenid` (`citizenid`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `players` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`citizenid` varchar(50) NOT NULL,
`cid` int(11) DEFAULT NULL,
`license` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`money` text NOT NULL,
`charinfo` text DEFAULT NULL,
`job` text NOT NULL,
`gang` text DEFAULT NULL,
`position` text NOT NULL,
`metadata` text NOT NULL,
`inventory` longtext DEFAULT NULL,
`phone_number` VARCHAR(20) DEFAULT NULL,
`last_updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`citizenid`),
KEY `id` (`id`),
KEY `last_updated` (`last_updated`),
KEY `license` (`license`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

ALTER TABLE `players`
ADD IF NOT EXISTS `last_logged_out` timestamp NULL DEFAULT NULL AFTER `last_updated`,
MODIFY COLUMN `name` varchar(50) NOT NULL COLLATE utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `playerskins` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`citizenid` varchar(255) NOT NULL,
Expand Down Expand Up @@ -184,84 +56,6 @@ CREATE TABLE IF NOT EXISTS `player_outfit_codes` (
KEY `FK_player_outfit_codes_player_outfits` (`outfitid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `player_vehicles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`license` varchar(50) DEFAULT NULL,
`citizenid` varchar(50) DEFAULT NULL,
`vehicle` varchar(50) DEFAULT NULL,
`hash` varchar(50) DEFAULT NULL,
`mods` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`plate` varchar(50) NOT NULL,
`fakeplate` varchar(50) DEFAULT NULL,
`garage` varchar(50) DEFAULT NULL,
`fuel` int(11) DEFAULT 100,
`engine` float DEFAULT 1000,
`body` float DEFAULT 1000,
`state` int(11) DEFAULT 1,
`depotprice` int(11) NOT NULL DEFAULT 0,
`drivingdistance` int(50) DEFAULT NULL,
`status` text DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `plate` (`plate`),
KEY `citizenid` (`citizenid`),
KEY `license` (`license`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `player_warns` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`senderIdentifier` varchar(50) DEFAULT NULL,
`targetIdentifier` varchar(50) DEFAULT NULL,
`reason` text DEFAULT NULL,
`warnId` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `player_groups` (
`citizenid` VARCHAR(50) NOT NULL,
`group` VARCHAR(50) NOT NULL,
`type` VARCHAR(50) NOT NULL,
`grade` TINYINT(3) UNSIGNED NOT NULL,
PRIMARY KEY (`citizenid`, `type`, `group`),
CONSTRAINT `fk_citizenid` FOREIGN KEY (`citizenid`) REFERENCES `players` (`citizenid`) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `management_funds` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`job_name` VARCHAR(50) NOT NULL,
`amount` INT(100) NOT NULL,
`type` ENUM('boss','gang') NOT NULL DEFAULT 'boss',
PRIMARY KEY (`id`),
UNIQUE KEY `job_name` (`job_name`),
KEY `type` (`type`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `management_funds` (`job_name`, `amount`, `type`) VALUES
('police', 0, 'boss'),
('ambulance', 0, 'boss'),
('realestate', 0, 'boss'),
('taxi', 0, 'boss'),
('cardealer', 0, 'boss'),
('mechanic', 0, 'boss'),
('lostmc', 0, 'gang'),
('ballas', 0, 'gang'),
('vagos', 0, 'gang'),
('cartel', 0, 'gang'),
('families', 0, 'gang'),
('triads', 0, 'gang');

CREATE TABLE IF NOT EXISTS `player_jobs_activity` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`citizenid` VARCHAR(50) COLLATE utf8mb4_unicode_ci,
`job` varchar(255) NOT NULL,
`last_checkin` int NOT NULL,
`last_checkout` int NULL DEFAULT NULL,
FOREIGN KEY (`citizenid`) REFERENCES `players` (`citizenid`) ON DELETE CASCADE,
PRIMARY KEY (`id`) USING BTREE,
INDEX `id` (`id` DESC) USING BTREE,
INDEX `last_checkout` (`last_checkout` ASC) USING BTREE,
INDEX `citizenid_job` (`citizenid`, `job`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci;

CREATE TABLE IF NOT EXISTS `ox_doorlock` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
Expand Down Expand Up @@ -293,42 +87,3 @@ CREATE TABLE IF NOT EXISTS `player_transactions` (
`transactions` longtext,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `vehicle_financing` (
`vehicleId` int(11) NOT NULL,
`balance` int(11) DEFAULT NULL,
`paymentamount` int(11) DEFAULT NULL,
`paymentsleft` int(11) DEFAULT NULL,
`financetime` int(11) DEFAULT NULL,
PRIMARY KEY (`vehicleId`),
FOREIGN KEY `vehicleId` (`vehicleId`) REFERENCES `player_vehicles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `properties` (
`id` INT NOT NULL AUTO_INCREMENT,
`property_name` VARCHAR(255) NOT NULL, /* simple label that can be used to identify which property it is. I.e. used for spawn list */
`coords` JSON NOT NULL, /* vec3 world coords for the entry position */
`price` INT NOT NULL DEFAULT 0,
`owner` VARCHAR(255), /* citizen ID of the owner */
`interior` VARCHAR(255) NOT NULL, /* the interior name, can range from IPL name to a shell hash that needs to spawn in */
`keyholders` JSON NOT NULL DEFAULT (JSON_OBJECT()), /* citizen IDs of other people that have access */
`rent_interval` INT DEFAULT NULL, /* the rent interval in hours */
`interact_options` JSON NOT NULL DEFAULT (JSON_OBJECT()), /* clothing and exit points */
`stash_options` JSON NOT NULL DEFAULT (JSON_OBJECT()), /* multiple stash support */
`decorations` JSON NOT NULL DEFAULT (JSON_OBJECT()), /* the model name with its corresponding coords that needs to be placed */
FOREIGN KEY (owner) REFERENCES `players` (`citizenid`),
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `weed_plants` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`property` varchar(30) NULL,
`stage` tinyint NOT NULL DEFAULT 1,
`sort` varchar(30) NOT NULL,
`gender` enum('male', 'female') NOT NULL,
`food` tinyint NOT NULL DEFAULT 100,
`health` tinyint NOT NULL DEFAULT 100,
`stageProgress` tinyint NOT NULL DEFAULT 0,
`coords` tinytext NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
Loading

0 comments on commit d303852

Please sign in to comment.