Skip to content

Commit

Permalink
feat: player_vehicles should be in qbx_vehicles, DEFAULT NULL & id as FK
Browse files Browse the repository at this point in the history
  • Loading branch information
TonybynMp4 authored Feb 28, 2024
1 parent 9ecddd7 commit 0c99840
Showing 1 changed file with 7 additions and 30 deletions.
37 changes: 7 additions & 30 deletions vehshop.sql
Original file line number Diff line number Diff line change
@@ -1,35 +1,12 @@
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` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`plate` varchar(15) NOT NULL,
`fakeplate` varchar(50) DEFAULT NULL,
`garage` varchar(50) DEFAULT 'pillboxgarage',
`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`),
UNIQUE KEY `plate` (`plate`),
FOREIGN KEY (`citizenid`) REFERENCES `players` (`citizenid`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`license`) REFERENCES `players` (`license`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

0 comments on commit 0c99840

Please sign in to comment.