-- Vehicle catalog update
CREATE TABLE IF NOT EXISTS vehicle_makes (
  id INT AUTO_INCREMENT PRIMARY KEY,
  company_id INT NULL,
  name VARCHAR(120) NOT NULL,
  name_ar VARCHAR(120) NULL,
  is_system TINYINT(1) NOT NULL DEFAULT 1,
  is_active TINYINT(1) NOT NULL DEFAULT 1,
  sort_order INT NOT NULL DEFAULT 0,
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME NULL DEFAULT NULL,
  UNIQUE KEY uniq_vehicle_makes_scope_name (company_id, name),
  KEY idx_vehicle_makes_scope (company_id, is_active, sort_order)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS vehicle_models (
  id INT AUTO_INCREMENT PRIMARY KEY,
  make_id INT NOT NULL,
  name VARCHAR(120) NOT NULL,
  name_ar VARCHAR(120) NULL,
  is_system TINYINT(1) NOT NULL DEFAULT 1,
  is_active TINYINT(1) NOT NULL DEFAULT 1,
  sort_order INT NOT NULL DEFAULT 0,
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME NULL DEFAULT NULL,
  UNIQUE KEY uniq_vehicle_models_make_name (make_id, name),
  KEY idx_vehicle_models_make (make_id, is_active, sort_order),
  CONSTRAINT fk_vehicle_models_make FOREIGN KEY (make_id) REFERENCES vehicle_makes(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS vehicle_trims (
  id INT AUTO_INCREMENT PRIMARY KEY,
  model_id INT NOT NULL,
  name VARCHAR(120) NOT NULL,
  name_ar VARCHAR(120) NULL,
  full_name VARCHAR(255) NULL,
  is_system TINYINT(1) NOT NULL DEFAULT 1,
  is_active TINYINT(1) NOT NULL DEFAULT 1,
  sort_order INT NOT NULL DEFAULT 0,
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME NULL DEFAULT NULL,
  UNIQUE KEY uniq_vehicle_trims_model_name (model_id, name),
  KEY idx_vehicle_trims_model (model_id, is_active, sort_order),
  CONSTRAINT fk_vehicle_trims_model FOREIGN KEY (model_id) REFERENCES vehicle_models(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE vehicles ADD COLUMN make_id INT NULL AFTER plate_no;
ALTER TABLE vehicles ADD COLUMN model_id INT NULL AFTER make_id;
ALTER TABLE vehicles ADD COLUMN trim_id INT NULL AFTER model_id;
ALTER TABLE vehicles ADD KEY idx_vehicles_make_id (make_id);
ALTER TABLE vehicles ADD KEY idx_vehicles_model_id (model_id);
ALTER TABLE vehicles ADD KEY idx_vehicles_trim_id (trim_id);

-- Seed catalog
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Mercedes-Benz',NULL,1,1,10);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'A-Class',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Mercedes-Benz';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'A180',NULL,'Mercedes-Benz A-Class A180',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='A-Class';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'A200',NULL,'Mercedes-Benz A-Class A200',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='A-Class';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'A250',NULL,'Mercedes-Benz A-Class A250',1,1,30 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='A-Class';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'C-Class',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Mercedes-Benz';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'C180',NULL,'Mercedes-Benz C-Class C180',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='C-Class';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'C200',NULL,'Mercedes-Benz C-Class C200',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='C-Class';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'C300',NULL,'Mercedes-Benz C-Class C300',1,1,30 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='C-Class';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'E-Class',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Mercedes-Benz';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'E200',NULL,'Mercedes-Benz E-Class E200',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='E-Class';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'E300',NULL,'Mercedes-Benz E-Class E300',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='E-Class';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'E350',NULL,'Mercedes-Benz E-Class E350',1,1,30 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='E-Class';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'S-Class',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Mercedes-Benz';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'S450',NULL,'Mercedes-Benz S-Class S450',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='S-Class';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'S500',NULL,'Mercedes-Benz S-Class S500',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='S-Class';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'CLA',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Mercedes-Benz';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'CLA 200',NULL,'Mercedes-Benz CLA CLA 200',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='CLA';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'CLA 250',NULL,'Mercedes-Benz CLA CLA 250',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='CLA';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'GLA',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='Mercedes-Benz';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'GLA 200',NULL,'Mercedes-Benz GLA GLA 200',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='GLA';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'GLA 250',NULL,'Mercedes-Benz GLA GLA 250',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='GLA';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'GLC',NULL,1,1,70 FROM vehicle_makes WHERE company_id IS NULL AND name='Mercedes-Benz';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'GLC 200',NULL,'Mercedes-Benz GLC GLC 200',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='GLC';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'GLC 300',NULL,'Mercedes-Benz GLC GLC 300',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='GLC';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'GLE',NULL,1,1,80 FROM vehicle_makes WHERE company_id IS NULL AND name='Mercedes-Benz';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'GLE 350',NULL,'Mercedes-Benz GLE GLE 350',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='GLE';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'GLE 450',NULL,'Mercedes-Benz GLE GLE 450',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='GLE';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'V-Class',NULL,1,1,90 FROM vehicle_makes WHERE company_id IS NULL AND name='Mercedes-Benz';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'V250',NULL,'Mercedes-Benz V-Class V250',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='V-Class';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'V300',NULL,'Mercedes-Benz V-Class V300',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='V-Class';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Viano',NULL,1,1,100 FROM vehicle_makes WHERE company_id IS NULL AND name='Mercedes-Benz';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Viano 2.2',NULL,'Mercedes-Benz Viano Viano 2.2',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='Viano';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Viano 3.0',NULL,'Mercedes-Benz Viano Viano 3.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='Viano';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Sprinter',NULL,1,1,110 FROM vehicle_makes WHERE company_id IS NULL AND name='Mercedes-Benz';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'311 CDI',NULL,'Mercedes-Benz Sprinter 311 CDI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='Sprinter';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'316 CDI',NULL,'Mercedes-Benz Sprinter 316 CDI',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mercedes-Benz' AND vm.name='Sprinter';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'BMW',NULL,1,1,20);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'1 Series',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='BMW';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'118i',NULL,'BMW 1 Series 118i',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='1 Series';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'120i',NULL,'BMW 1 Series 120i',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='1 Series';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'3 Series',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='BMW';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'318i',NULL,'BMW 3 Series 318i',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='3 Series';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'320i',NULL,'BMW 3 Series 320i',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='3 Series';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'330i',NULL,'BMW 3 Series 330i',1,1,30 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='3 Series';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'5 Series',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='BMW';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'520i',NULL,'BMW 5 Series 520i',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='5 Series';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'530i',NULL,'BMW 5 Series 530i',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='5 Series';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'7 Series',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='BMW';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'730i',NULL,'BMW 7 Series 730i',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='7 Series';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'740i',NULL,'BMW 7 Series 740i',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='7 Series';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'X1',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='BMW';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'sDrive18i',NULL,'BMW X1 sDrive18i',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='X1';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'sDrive20i',NULL,'BMW X1 sDrive20i',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='X1';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'X3',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='BMW';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'xDrive20i',NULL,'BMW X3 xDrive20i',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='X3';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'xDrive30i',NULL,'BMW X3 xDrive30i',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='X3';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'X5',NULL,1,1,70 FROM vehicle_makes WHERE company_id IS NULL AND name='BMW';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'xDrive40i',NULL,'BMW X5 xDrive40i',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='X5';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'xDrive50e',NULL,'BMW X5 xDrive50e',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BMW' AND vm.name='X5';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Audi',NULL,1,1,30);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'A3',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Audi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'30 TFSI',NULL,'Audi A3 30 TFSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='A3';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'35 TFSI',NULL,'Audi A3 35 TFSI',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='A3';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'A4',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Audi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'35 TFSI',NULL,'Audi A4 35 TFSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='A4';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'40 TFSI',NULL,'Audi A4 40 TFSI',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='A4';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'A6',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Audi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'40 TFSI',NULL,'Audi A6 40 TFSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='A6';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'45 TFSI',NULL,'Audi A6 45 TFSI',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='A6';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Q3',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Audi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'35 TFSI',NULL,'Audi Q3 35 TFSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='Q3';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'40 TFSI',NULL,'Audi Q3 40 TFSI',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='Q3';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Q5',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Audi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'40 TFSI',NULL,'Audi Q5 40 TFSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='Q5';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'45 TFSI',NULL,'Audi Q5 45 TFSI',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='Q5';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Q7',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='Audi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'45 TFSI',NULL,'Audi Q7 45 TFSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='Q7';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'55 TFSI',NULL,'Audi Q7 55 TFSI',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Audi' AND vm.name='Q7';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Toyota',NULL,1,1,40);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Yaris',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Toyota';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.3',NULL,'Toyota Yaris 1.3',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Yaris';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Toyota Yaris 1.5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Yaris';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Corolla',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Toyota';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Toyota Corolla 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Corolla';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Toyota Corolla 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Corolla';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Camry',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Toyota';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Toyota Camry 2.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Camry';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.5',NULL,'Toyota Camry 3.5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Camry';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Avalon',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Toyota';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.5',NULL,'Toyota Avalon 3.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Avalon';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'RAV4',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Toyota';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Toyota RAV4 2.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='RAV4';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Toyota RAV4 2.5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='RAV4';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Fortuner',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='Toyota';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.7',NULL,'Toyota Fortuner 2.7',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Fortuner';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'4.0',NULL,'Toyota Fortuner 4.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Fortuner';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Land Cruiser',NULL,1,1,70 FROM vehicle_makes WHERE company_id IS NULL AND name='Toyota';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'GX.R',NULL,'Toyota Land Cruiser GX.R',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Land Cruiser';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'VX.R',NULL,'Toyota Land Cruiser VX.R',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Land Cruiser';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Hiace',NULL,1,1,80 FROM vehicle_makes WHERE company_id IS NULL AND name='Toyota';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.7',NULL,'Toyota Hiace 2.7',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Hiace';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.5',NULL,'Toyota Hiace 3.5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Toyota' AND vm.name='Hiace';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Honda',NULL,1,1,50);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'City',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Honda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Honda City 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Honda' AND vm.name='City';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Civic',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Honda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5T',NULL,'Honda Civic 1.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Honda' AND vm.name='Civic';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Honda Civic 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Honda' AND vm.name='Civic';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Accord',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Honda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5T',NULL,'Honda Accord 1.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Honda' AND vm.name='Accord';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0T',NULL,'Honda Accord 2.0T',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Honda' AND vm.name='Accord';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'CR-V',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Honda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5T',NULL,'Honda CR-V 1.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Honda' AND vm.name='CR-V';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.4',NULL,'Honda CR-V 2.4',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Honda' AND vm.name='CR-V';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'HR-V',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Honda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Honda HR-V 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Honda' AND vm.name='HR-V';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Nissan',NULL,1,1,60);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Sunny',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Nissan';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Nissan Sunny 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Nissan' AND vm.name='Sunny';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Sentra',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Nissan';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Nissan Sentra 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Nissan' AND vm.name='Sentra';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Nissan Sentra 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Nissan' AND vm.name='Sentra';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Altima',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Nissan';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Nissan Altima 2.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Nissan' AND vm.name='Altima';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0T',NULL,'Nissan Altima 2.0T',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Nissan' AND vm.name='Altima';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'X-Trail',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Nissan';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Nissan X-Trail 2.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Nissan' AND vm.name='X-Trail';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Patrol',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Nissan';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'SE',NULL,'Nissan Patrol SE',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Nissan' AND vm.name='Patrol';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'LE',NULL,'Nissan Patrol LE',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Nissan' AND vm.name='Patrol';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Platinum',NULL,'Nissan Patrol Platinum',1,1,30 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Nissan' AND vm.name='Patrol';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Urvan',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='Nissan';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Nissan Urvan 2.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Nissan' AND vm.name='Urvan';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.0',NULL,'Nissan Urvan 3.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Nissan' AND vm.name='Urvan';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Hyundai',NULL,1,1,70);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Accent',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Hyundai';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4',NULL,'Hyundai Accent 1.4',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='Accent';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Hyundai Accent 1.6',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='Accent';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Elantra',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Hyundai';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Hyundai Elantra 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='Elantra';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Hyundai Elantra 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='Elantra';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Sonata',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Hyundai';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Hyundai Sonata 2.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='Sonata';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Hyundai Sonata 2.5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='Sonata';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Tucson',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Hyundai';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6T',NULL,'Hyundai Tucson 1.6T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='Tucson';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Hyundai Tucson 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='Tucson';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Santa Fe',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Hyundai';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Hyundai Santa Fe 2.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='Santa Fe';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.5',NULL,'Hyundai Santa Fe 3.5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='Santa Fe';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Staria',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='Hyundai';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.5',NULL,'Hyundai Staria 3.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='Staria';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'H1',NULL,1,1,70 FROM vehicle_makes WHERE company_id IS NULL AND name='Hyundai';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5 CRDi',NULL,'Hyundai H1 2.5 CRDi',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Hyundai' AND vm.name='H1';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Kia',NULL,1,1,80);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Rio',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Kia';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4',NULL,'Kia Rio 1.4',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Kia' AND vm.name='Rio';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Kia Rio 1.6',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Kia' AND vm.name='Rio';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Cerato',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Kia';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Kia Cerato 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Kia' AND vm.name='Cerato';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Kia Cerato 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Kia' AND vm.name='Cerato';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'K5',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Kia';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Kia K5 2.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Kia' AND vm.name='K5';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Kia K5 2.5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Kia' AND vm.name='K5';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Sportage',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Kia';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6T',NULL,'Kia Sportage 1.6T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Kia' AND vm.name='Sportage';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Kia Sportage 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Kia' AND vm.name='Sportage';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Sorento',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Kia';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Kia Sorento 2.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Kia' AND vm.name='Sorento';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.5',NULL,'Kia Sorento 3.5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Kia' AND vm.name='Sorento';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Carnival',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='Kia';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.5',NULL,'Kia Carnival 3.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Kia' AND vm.name='Carnival';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Ford',NULL,1,1,90);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Focus',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Ford';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Ford Focus 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Ford' AND vm.name='Focus';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Ford Focus 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Ford' AND vm.name='Focus';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Fusion',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Ford';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Ford Fusion 2.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Ford' AND vm.name='Fusion';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Escape',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Ford';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Ford Escape 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Ford' AND vm.name='Escape';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Ford Escape 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Ford' AND vm.name='Escape';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Explorer',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Ford';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.3T',NULL,'Ford Explorer 2.3T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Ford' AND vm.name='Explorer';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.0T',NULL,'Ford Explorer 3.0T',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Ford' AND vm.name='Explorer';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Transit',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Ford';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.2 TDCi',NULL,'Ford Transit 2.2 TDCi',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Ford' AND vm.name='Transit';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.5',NULL,'Ford Transit 3.5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Ford' AND vm.name='Transit';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Chevrolet',NULL,1,1,100);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Aveo',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Chevrolet';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Chevrolet Aveo 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chevrolet' AND vm.name='Aveo';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Optra',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Chevrolet';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Chevrolet Optra 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chevrolet' AND vm.name='Optra';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Malibu',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Chevrolet';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5T',NULL,'Chevrolet Malibu 1.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chevrolet' AND vm.name='Malibu';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0T',NULL,'Chevrolet Malibu 2.0T',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chevrolet' AND vm.name='Malibu';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Captiva',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Chevrolet';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5T',NULL,'Chevrolet Captiva 1.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chevrolet' AND vm.name='Captiva';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.4',NULL,'Chevrolet Captiva 2.4',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chevrolet' AND vm.name='Captiva';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Tahoe',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Chevrolet';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'5.3',NULL,'Chevrolet Tahoe 5.3',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chevrolet' AND vm.name='Tahoe';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Suburban',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='Chevrolet';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'5.3',NULL,'Chevrolet Suburban 5.3',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chevrolet' AND vm.name='Suburban';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'6.2',NULL,'Chevrolet Suburban 6.2',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chevrolet' AND vm.name='Suburban';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Volkswagen',NULL,1,1,110);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Polo',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Volkswagen';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.0 TSI',NULL,'Volkswagen Polo 1.0 TSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volkswagen' AND vm.name='Polo';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Volkswagen Polo 1.6',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volkswagen' AND vm.name='Polo';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Jetta',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Volkswagen';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4 TSI',NULL,'Volkswagen Jetta 1.4 TSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volkswagen' AND vm.name='Jetta';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Volkswagen Jetta 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volkswagen' AND vm.name='Jetta';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Passat',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Volkswagen';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.8 TSI',NULL,'Volkswagen Passat 1.8 TSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volkswagen' AND vm.name='Passat';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0 TSI',NULL,'Volkswagen Passat 2.0 TSI',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volkswagen' AND vm.name='Passat';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Tiguan',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Volkswagen';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4 TSI',NULL,'Volkswagen Tiguan 1.4 TSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volkswagen' AND vm.name='Tiguan';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0 TSI',NULL,'Volkswagen Tiguan 2.0 TSI',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volkswagen' AND vm.name='Tiguan';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Teramont',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Volkswagen';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0 TSI',NULL,'Volkswagen Teramont 2.0 TSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volkswagen' AND vm.name='Teramont';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.6',NULL,'Volkswagen Teramont 3.6',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volkswagen' AND vm.name='Teramont';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Skoda',NULL,1,1,120);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Fabia',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Skoda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.0',NULL,'Skoda Fabia 1.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Skoda' AND vm.name='Fabia';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Skoda Fabia 1.6',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Skoda' AND vm.name='Fabia';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Octavia',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Skoda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4 TSI',NULL,'Skoda Octavia 1.4 TSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Skoda' AND vm.name='Octavia';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Skoda Octavia 1.6',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Skoda' AND vm.name='Octavia';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Superb',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Skoda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4 TSI',NULL,'Skoda Superb 1.4 TSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Skoda' AND vm.name='Superb';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0 TSI',NULL,'Skoda Superb 2.0 TSI',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Skoda' AND vm.name='Superb';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Kodiaq',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Skoda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4 TSI',NULL,'Skoda Kodiaq 1.4 TSI',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Skoda' AND vm.name='Kodiaq';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0 TSI',NULL,'Skoda Kodiaq 2.0 TSI',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Skoda' AND vm.name='Kodiaq';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Renault',NULL,1,1,130);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Logan',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Renault';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Renault Logan 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Renault' AND vm.name='Logan';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Sandero',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Renault';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Renault Sandero 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Renault' AND vm.name='Sandero';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Megane',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Renault';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Renault Megane 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Renault' AND vm.name='Megane';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.3 TCe',NULL,'Renault Megane 1.3 TCe',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Renault' AND vm.name='Megane';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Duster',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Renault';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Renault Duster 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Renault' AND vm.name='Duster';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Renault Duster 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Renault' AND vm.name='Duster';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Koleos',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Renault';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Renault Koleos 2.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Renault' AND vm.name='Koleos';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Trafic',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='Renault';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0 dCi',NULL,'Renault Trafic 2.0 dCi',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Renault' AND vm.name='Trafic';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Peugeot',NULL,1,1,140);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'301',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Peugeot';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Peugeot 301 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Peugeot' AND vm.name='301';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'308',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Peugeot';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.2',NULL,'Peugeot 308 1.2',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Peugeot' AND vm.name='308';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Peugeot 308 1.6',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Peugeot' AND vm.name='308';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'508',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Peugeot';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6T',NULL,'Peugeot 508 1.6T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Peugeot' AND vm.name='508';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'2008',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Peugeot';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.2',NULL,'Peugeot 2008 1.2',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Peugeot' AND vm.name='2008';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Peugeot 2008 1.6',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Peugeot' AND vm.name='2008';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'3008',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Peugeot';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6T',NULL,'Peugeot 3008 1.6T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Peugeot' AND vm.name='3008';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'5008',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='Peugeot';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6T',NULL,'Peugeot 5008 1.6T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Peugeot' AND vm.name='5008';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Mazda',NULL,1,1,150);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Mazda 2',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Mazda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Mazda Mazda 2 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mazda' AND vm.name='Mazda 2';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Mazda 3',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Mazda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Mazda Mazda 3 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mazda' AND vm.name='Mazda 3';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Mazda Mazda 3 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mazda' AND vm.name='Mazda 3';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Mazda 6',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Mazda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Mazda Mazda 6 2.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mazda' AND vm.name='Mazda 6';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Mazda Mazda 6 2.5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mazda' AND vm.name='Mazda 6';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'CX-3',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Mazda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Mazda CX-3 2.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mazda' AND vm.name='CX-3';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'CX-5',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Mazda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Mazda CX-5 2.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mazda' AND vm.name='CX-5';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Mazda CX-5 2.5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mazda' AND vm.name='CX-5';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'CX-9',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='Mazda';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5T',NULL,'Mazda CX-9 2.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mazda' AND vm.name='CX-9';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Mitsubishi',NULL,1,1,160);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Mirage',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Mitsubishi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.2',NULL,'Mitsubishi Mirage 1.2',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mitsubishi' AND vm.name='Mirage';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Lancer',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Mitsubishi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Mitsubishi Lancer 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mitsubishi' AND vm.name='Lancer';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Mitsubishi Lancer 2.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mitsubishi' AND vm.name='Lancer';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Xpander',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Mitsubishi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Mitsubishi Xpander 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mitsubishi' AND vm.name='Xpander';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Outlander',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Mitsubishi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.5',NULL,'Mitsubishi Outlander 2.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mitsubishi' AND vm.name='Outlander';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Pajero',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Mitsubishi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.0',NULL,'Mitsubishi Pajero 3.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mitsubishi' AND vm.name='Pajero';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.8',NULL,'Mitsubishi Pajero 3.8',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mitsubishi' AND vm.name='Pajero';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'L200',NULL,1,1,60 FROM vehicle_makes WHERE company_id IS NULL AND name='Mitsubishi';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.4 DI-D',NULL,'Mitsubishi L200 2.4 DI-D',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Mitsubishi' AND vm.name='L200';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Suzuki',NULL,1,1,170);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Dzire',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Suzuki';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.2',NULL,'Suzuki Dzire 1.2',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Suzuki' AND vm.name='Dzire';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Swift',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Suzuki';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.2',NULL,'Suzuki Swift 1.2',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Suzuki' AND vm.name='Swift';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Ciaz',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Suzuki';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Suzuki Ciaz 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Suzuki' AND vm.name='Ciaz';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Vitara',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Suzuki';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Suzuki Vitara 1.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Suzuki' AND vm.name='Vitara';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Ertiga',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Suzuki';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Suzuki Ertiga 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Suzuki' AND vm.name='Ertiga';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Isuzu',NULL,1,1,180);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'D-Max',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Isuzu';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.9',NULL,'Isuzu D-Max 1.9',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Isuzu' AND vm.name='D-Max';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.0',NULL,'Isuzu D-Max 3.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Isuzu' AND vm.name='D-Max';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'MU-X',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Isuzu';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.0',NULL,'Isuzu MU-X 3.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Isuzu' AND vm.name='MU-X';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Fiat',NULL,1,1,190);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Tipo',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Fiat';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4',NULL,'Fiat Tipo 1.4',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Fiat' AND vm.name='Tipo';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Fiat Tipo 1.6',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Fiat' AND vm.name='Tipo';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'500',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Fiat';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.2',NULL,'Fiat 500 1.2',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Fiat' AND vm.name='500';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4',NULL,'Fiat 500 1.4',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Fiat' AND vm.name='500';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'500X',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Fiat';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4T',NULL,'Fiat 500X 1.4T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Fiat' AND vm.name='500X';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Doblo',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Fiat';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4',NULL,'Fiat Doblo 1.4',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Fiat' AND vm.name='Doblo';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6',NULL,'Fiat Doblo 1.6',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Fiat' AND vm.name='Doblo';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Ducato',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='Fiat';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.3 Multijet',NULL,'Fiat Ducato 2.3 Multijet',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Fiat' AND vm.name='Ducato';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Jeep',NULL,1,1,200);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Renegade',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Jeep';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.3T',NULL,'Jeep Renegade 1.3T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Jeep' AND vm.name='Renegade';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.4T',NULL,'Jeep Renegade 1.4T',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Jeep' AND vm.name='Renegade';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Compass',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Jeep';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.3T',NULL,'Jeep Compass 1.3T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Jeep' AND vm.name='Compass';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.4',NULL,'Jeep Compass 2.4',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Jeep' AND vm.name='Compass';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Grand Cherokee',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Jeep';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.6',NULL,'Jeep Grand Cherokee 3.6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Jeep' AND vm.name='Grand Cherokee';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'5.7',NULL,'Jeep Grand Cherokee 5.7',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Jeep' AND vm.name='Grand Cherokee';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Land Rover',NULL,1,1,210);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Range Rover Evoque',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Land Rover';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Land Rover Range Rover Evoque 2.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Land Rover' AND vm.name='Range Rover Evoque';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Range Rover Sport',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Land Rover';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.0',NULL,'Land Rover Range Rover Sport 3.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Land Rover' AND vm.name='Range Rover Sport';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'5.0',NULL,'Land Rover Range Rover Sport 5.0',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Land Rover' AND vm.name='Range Rover Sport';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Discovery',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Land Rover';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.0',NULL,'Land Rover Discovery 3.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Land Rover' AND vm.name='Discovery';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Defender',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Land Rover';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'90',NULL,'Land Rover Defender 90',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Land Rover' AND vm.name='Defender';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'110',NULL,'Land Rover Defender 110',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Land Rover' AND vm.name='Defender';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Lexus',NULL,1,1,220);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'ES',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Lexus';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'250',NULL,'Lexus ES 250',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Lexus' AND vm.name='ES';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'350',NULL,'Lexus ES 350',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Lexus' AND vm.name='ES';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'LS',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Lexus';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'500',NULL,'Lexus LS 500',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Lexus' AND vm.name='LS';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'RX',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Lexus';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'350',NULL,'Lexus RX 350',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Lexus' AND vm.name='RX';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'500h',NULL,'Lexus RX 500h',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Lexus' AND vm.name='RX';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'LX',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Lexus';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'570',NULL,'Lexus LX 570',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Lexus' AND vm.name='LX';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'600',NULL,'Lexus LX 600',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Lexus' AND vm.name='LX';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Volvo',NULL,1,1,230);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'S60',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Volvo';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'B4',NULL,'Volvo S60 B4',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volvo' AND vm.name='S60';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'T5',NULL,'Volvo S60 T5',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volvo' AND vm.name='S60';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'S90',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Volvo';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'B5',NULL,'Volvo S90 B5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volvo' AND vm.name='S90';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'XC60',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Volvo';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'B5',NULL,'Volvo XC60 B5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volvo' AND vm.name='XC60';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'T6',NULL,'Volvo XC60 T6',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volvo' AND vm.name='XC60';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'XC90',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Volvo';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'B6',NULL,'Volvo XC90 B6',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volvo' AND vm.name='XC90';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'T8',NULL,'Volvo XC90 T8',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Volvo' AND vm.name='XC90';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Porsche',NULL,1,1,240);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Macan',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Porsche';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0',NULL,'Porsche Macan 2.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Porsche' AND vm.name='Macan';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'GTS',NULL,'Porsche Macan GTS',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Porsche' AND vm.name='Macan';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Cayenne',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Porsche';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'3.0',NULL,'Porsche Cayenne 3.0',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Porsche' AND vm.name='Cayenne';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Turbo',NULL,'Porsche Cayenne Turbo',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Porsche' AND vm.name='Cayenne';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Panamera',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Porsche';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'4',NULL,'Porsche Panamera 4',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Porsche' AND vm.name='Panamera';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'4S',NULL,'Porsche Panamera 4S',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Porsche' AND vm.name='Panamera';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Tesla',NULL,1,1,250);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Model 3',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Tesla';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Standard Range',NULL,'Tesla Model 3 Standard Range',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Tesla' AND vm.name='Model 3';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Long Range',NULL,'Tesla Model 3 Long Range',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Tesla' AND vm.name='Model 3';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Performance',NULL,'Tesla Model 3 Performance',1,1,30 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Tesla' AND vm.name='Model 3';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Model Y',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Tesla';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Long Range',NULL,'Tesla Model Y Long Range',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Tesla' AND vm.name='Model Y';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Performance',NULL,'Tesla Model Y Performance',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Tesla' AND vm.name='Model Y';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Model S',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Tesla';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Long Range',NULL,'Tesla Model S Long Range',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Tesla' AND vm.name='Model S';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Plaid',NULL,'Tesla Model S Plaid',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Tesla' AND vm.name='Model S';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Model X',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Tesla';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Long Range',NULL,'Tesla Model X Long Range',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Tesla' AND vm.name='Model X';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Plaid',NULL,'Tesla Model X Plaid',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Tesla' AND vm.name='Model X';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'BYD',NULL,1,1,260);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Qin Plus',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='BYD';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'DM-i',NULL,'BYD Qin Plus DM-i',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BYD' AND vm.name='Qin Plus';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'EV',NULL,'BYD Qin Plus EV',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BYD' AND vm.name='Qin Plus';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Han',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='BYD';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'EV',NULL,'BYD Han EV',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BYD' AND vm.name='Han';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'DM-i',NULL,'BYD Han DM-i',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BYD' AND vm.name='Han';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Song Plus',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='BYD';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'DM-i',NULL,'BYD Song Plus DM-i',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BYD' AND vm.name='Song Plus';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'EV',NULL,'BYD Song Plus EV',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BYD' AND vm.name='Song Plus';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Atto 3',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='BYD';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Standard Range',NULL,'BYD Atto 3 Standard Range',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BYD' AND vm.name='Atto 3';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'Extended Range',NULL,'BYD Atto 3 Extended Range',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='BYD' AND vm.name='Atto 3';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'MG',NULL,1,1,270);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'5',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='MG';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'MG 5 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='MG' AND vm.name='5';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'6',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='MG';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5T',NULL,'MG 6 1.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='MG' AND vm.name='6';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'ZS',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='MG';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'MG ZS 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='MG' AND vm.name='ZS';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'EV',NULL,'MG ZS EV',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='MG' AND vm.name='ZS';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'HS',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='MG';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5T',NULL,'MG HS 1.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='MG' AND vm.name='HS';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0T',NULL,'MG HS 2.0T',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='MG' AND vm.name='HS';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'RX5',NULL,1,1,50 FROM vehicle_makes WHERE company_id IS NULL AND name='MG';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5T',NULL,'MG RX5 1.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='MG' AND vm.name='RX5';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Chery',NULL,1,1,280);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Arrizo 5',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Chery';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Chery Arrizo 5 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chery' AND vm.name='Arrizo 5';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Tiggo 4 Pro',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Chery';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Chery Tiggo 4 Pro 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chery' AND vm.name='Tiggo 4 Pro';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Tiggo 7 Pro',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Chery';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5T',NULL,'Chery Tiggo 7 Pro 1.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chery' AND vm.name='Tiggo 7 Pro';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Tiggo 8 Pro',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Chery';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.6T',NULL,'Chery Tiggo 8 Pro 1.6T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chery' AND vm.name='Tiggo 8 Pro';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0T',NULL,'Chery Tiggo 8 Pro 2.0T',1,1,20 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Chery' AND vm.name='Tiggo 8 Pro';
INSERT IGNORE INTO vehicle_makes (company_id,name,name_ar,is_system,is_active,sort_order) VALUES (NULL,'Geely',NULL,1,1,290);
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Emgrand',NULL,1,1,10 FROM vehicle_makes WHERE company_id IS NULL AND name='Geely';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5',NULL,'Geely Emgrand 1.5',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Geely' AND vm.name='Emgrand';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Coolray',NULL,1,1,20 FROM vehicle_makes WHERE company_id IS NULL AND name='Geely';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5T',NULL,'Geely Coolray 1.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Geely' AND vm.name='Coolray';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Azkarra',NULL,1,1,30 FROM vehicle_makes WHERE company_id IS NULL AND name='Geely';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'1.5T',NULL,'Geely Azkarra 1.5T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Geely' AND vm.name='Azkarra';
INSERT IGNORE INTO vehicle_models (make_id,name,name_ar,is_system,is_active,sort_order) SELECT id,'Monjaro',NULL,1,1,40 FROM vehicle_makes WHERE company_id IS NULL AND name='Geely';
INSERT IGNORE INTO vehicle_trims (model_id,name,name_ar,full_name,is_system,is_active,sort_order) SELECT vm.id,'2.0T',NULL,'Geely Monjaro 2.0T',1,1,10 FROM vehicle_models vm JOIN vehicle_makes mk ON mk.id=vm.make_id WHERE mk.company_id IS NULL AND mk.name='Geely' AND vm.name='Monjaro';
