Skip to content

Commit

Permalink
DB connection test issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sawon authored and sawon committed Nov 6, 2022
1 parent f3bea18 commit 09fa7e3
Show file tree
Hide file tree
Showing 5 changed files with 243 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PHP_VERSION=8.1
# MySQL
MYSQL_VERSION=8.0.31
MYSQL_HOST=mysql
MYSQL_DATABASE=test
MYSQL_DATABASE=oscar
MYSQL_ROOT_USER=root
MYSQL_ROOT_PASSWORD=root
MYSQL_USER=dev
Expand Down
73 changes: 0 additions & 73 deletions doc/schema/setup.sql

This file was deleted.

2 changes: 1 addition & 1 deletion web/app/src/config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'mysql' => [
'host' => 'mysql',

'database' => 'test',
'database' => 'oscar',

'port' => '3306',

Expand Down
4 changes: 2 additions & 2 deletions web/app/tests/Lib/DB/MysqlDatabaseConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function testSuccessfulConnectionWithParams(): void
{
$config = [
'host' => 'mysql',
'database' => 'test',
'database' => 'oscar',
'port' => '3306',
'user' => 'root',
'pass' => 'root',
Expand Down Expand Up @@ -48,7 +48,7 @@ public function testUnsuccessfulConnection(): void
{
$config = [
'host' => 'mysql',
'database' => 'oscar',
'database' => 'test',
'port' => '3306',
'user' => 'root',
'pass' => 'root',
Expand Down
239 changes: 239 additions & 0 deletions web/schema/setup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: mysql
-- Generation Time: Nov 06, 2022 at 02:29 PM
-- Server version: 8.0.31
-- PHP Version: 8.0.19

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `oscar`
--

-- --------------------------------------------------------

--
-- Table structure for table `car_brands`
--

CREATE TABLE `car_brands` (
`id` bigint NOT NULL,
`brand_name` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `car_features`
--

CREATE TABLE `car_features` (
`id` bigint NOT NULL,
`vehicle_id` bigint DEFAULT NULL,
`inside_height` float DEFAULT NULL,
`inside_length` float DEFAULT NULL,
`inside_width` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `car_locations`
--

CREATE TABLE `car_locations` (
`id` bigint NOT NULL,
`location` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `car_models`
--

CREATE TABLE `car_models` (
`id` bigint NOT NULL,
`car_model` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `fuels`
--

CREATE TABLE `fuels` (
`id` bigint NOT NULL,
`name` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `fuel_vehicle`
--

CREATE TABLE `fuel_vehicle` (
`vehicle_id` bigint DEFAULT NULL,
`fuel_id` bigint DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- --------------------------------------------------------

--
-- Table structure for table `vehicles`
--

CREATE TABLE `vehicles` (
`id` bigint NOT NULL,
`location` bigint DEFAULT NULL,
`car_brand` bigint DEFAULT NULL,
`car_model` bigint DEFAULT NULL,
`license_plate` varchar(50) DEFAULT NULL,
`car_year` int DEFAULT '0',
`number_of_doors` int DEFAULT '0',
`number_of_seats` int DEFAULT '0',
`fuel_type` varchar(100) DEFAULT NULL,
`transmission` varchar(100) DEFAULT NULL,
`car_type_group` varchar(100) DEFAULT NULL,
`car_type` varchar(100) DEFAULT NULL,
`car_km` float DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `car_brands`
--
ALTER TABLE `car_brands`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `brand_name` (`brand_name`);

--
-- Indexes for table `car_features`
--
ALTER TABLE `car_features`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `vehicle_id` (`vehicle_id`);

--
-- Indexes for table `car_locations`
--
ALTER TABLE `car_locations`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `location` (`location`);

--
-- Indexes for table `car_models`
--
ALTER TABLE `car_models`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `car_model` (`car_model`);

--
-- Indexes for table `fuels`
--
ALTER TABLE `fuels`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `fuel_vehicle`
--
ALTER TABLE `fuel_vehicle`
ADD KEY `vehicle_id` (`vehicle_id`),
ADD KEY `fuel_id` (`fuel_id`);

--
-- Indexes for table `vehicles`
--
ALTER TABLE `vehicles`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `license_plate` (`license_plate`),
ADD KEY `location` (`location`),
ADD KEY `car_brand` (`car_brand`),
ADD KEY `car_model` (`car_model`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `car_brands`
--
ALTER TABLE `car_brands`
MODIFY `id` bigint NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `car_features`
--
ALTER TABLE `car_features`
MODIFY `id` bigint NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `car_locations`
--
ALTER TABLE `car_locations`
MODIFY `id` bigint NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `car_models`
--
ALTER TABLE `car_models`
MODIFY `id` bigint NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `fuels`
--
ALTER TABLE `fuels`
MODIFY `id` bigint NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `vehicles`
--
ALTER TABLE `vehicles`
MODIFY `id` bigint NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `car_features`
--
ALTER TABLE `car_features`
ADD CONSTRAINT `car_features_ibfk_1` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`);

--
-- Constraints for table `fuel_vehicle`
--
ALTER TABLE `fuel_vehicle`
ADD CONSTRAINT `fuel_vehicle_ibfk_1` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`),
ADD CONSTRAINT `fuel_vehicle_ibfk_2` FOREIGN KEY (`fuel_id`) REFERENCES `fuels` (`id`);

--
-- Constraints for table `vehicles`
--
ALTER TABLE `vehicles`
ADD CONSTRAINT `vehicles_ibfk_1` FOREIGN KEY (`location`) REFERENCES `car_locations` (`id`),
ADD CONSTRAINT `vehicles_ibfk_2` FOREIGN KEY (`car_brand`) REFERENCES `car_brands` (`id`),
ADD CONSTRAINT `vehicles_ibfk_3` FOREIGN KEY (`car_model`) REFERENCES `car_models` (`id`);
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

0 comments on commit 09fa7e3

Please sign in to comment.