SQL
CREATE TABLE IF NOT EXISTS `dealership_balance` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`dealership_id` VARCHAR(50) NOT NULL COLLATE 'latin1_swedish_ci',
`user_id` VARCHAR(50) NOT NULL COLLATE 'latin1_swedish_ci',
`description` VARCHAR(255) NOT NULL COLLATE 'latin1_swedish_ci',
`name` VARCHAR(50) NOT NULL COLLATE 'latin1_swedish_ci',
`amount` INT(11) UNSIGNED NOT NULL,
`type` BIT(1) NOT NULL COMMENT '0 = income | 1 = expense',
`isbuy` BIT(1) NOT NULL,
`date` INT(11) UNSIGNED NOT NULL,
PRIMARY KEY (`id`) USING BTREE
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `dealership_hired_players` (
`dealership_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`user_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`profile_img` VARCHAR(255) NOT NULL DEFAULT '
' COLLATE 'utf8mb4_general_ci',
`banner_img` VARCHAR(255) NOT NULL DEFAULT '
' COLLATE 'utf8mb4_general_ci',
`name` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`jobs_done` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`timer` INT(11) UNSIGNED NOT NULL,
PRIMARY KEY (`dealership_id`, `user_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `dealership_owner` (
`dealership_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`user_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`name` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`profile_img` VARCHAR(255) NOT NULL DEFAULT '
' COLLATE 'utf8mb4_general_ci',
`banner_img` VARCHAR(255) NOT NULL DEFAULT '
' COLLATE 'utf8mb4_general_ci',
`stock` TEXT NOT NULL COLLATE 'utf8mb4_general_ci',
`stock_prices` LONGTEXT NOT NULL COLLATE 'utf8mb4_general_ci',
`stock_sold` TEXT NOT NULL COLLATE 'utf8mb4_unicode_ci',
`money` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`total_money_spent` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`total_money_earned` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`timer` INT(11) UNSIGNED NOT NULL,
PRIMARY KEY (`dealership_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `dealership_requests` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`dealership_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`user_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`vehicle` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`plate` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`request_type` INT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0 = sell reques t| 1 = buy request',
`name` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`price` INT(11) UNSIGNED NOT NULL,
`status` INT(2) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0 = waiting | 1 = in progress | 2 = finished | 3 = cancelled',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `request` (`user_id`, `vehicle`, `request_type`, `plate`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `dealership_stock` (
`vehicle` VARCHAR(100) NOT NULL COLLATE 'latin1_swedish_ci',
`amount` INT(11) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`vehicle`) USING BTREE
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB;