diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-03-07 16:57:14 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-03-07 16:57:14 +0100 |
commit | ee88077eb90bc7f7f800fa04e78bf055fc552cd9 (patch) | |
tree | 58bec8e1eaba1dbaad9fb39b1e34c6a626205f80 | |
parent | a2e34fbf29156717eb4e3c0136921080816238cb (diff) |
format db init sql file and add scaffold for data import code
-rw-r--r-- | dbinit/.gitignore | 2 | ||||
-rw-r--r-- | dbinit/base.sql | 223 | ||||
-rwxr-xr-x | dbinit/import.py | 1 | ||||
-rw-r--r-- | dbinit/makefile | 5 | ||||
-rw-r--r-- | formula1.sql | 370 | ||||
-rw-r--r-- | readme.md | 3 |
6 files changed, 234 insertions, 370 deletions
diff --git a/dbinit/.gitignore b/dbinit/.gitignore new file mode 100644 index 0000000..8d4caec --- /dev/null +++ b/dbinit/.gitignore @@ -0,0 +1,2 @@ +data.sql +dbinit.sql diff --git a/dbinit/base.sql b/dbinit/base.sql new file mode 100644 index 0000000..79ada29 --- /dev/null +++ b/dbinit/base.sql @@ -0,0 +1,223 @@ +drop schema if exists `formula1`; +create schema if not exists `formula1`; +use `formula1`; + +drop table if exists `formula1`.`calender`; +create table if not exists `formula1`.`calender` ( + `ID` int not null auto_increment, + `year` year not null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible, + unique index `year_UNIQUE` (`year` asc) visible); + +drop table if exists `formula1`.`circuit`; +create table if not exists `formula1`.`circuit` ( + `ID` int not null auto_increment, + `name` varchar(45) null default null, + `length` int null default null, + `photo` mediumblob null default null, + `laps` int null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible); + +drop table if exists `formula1`.`function`; +create table if not exists `formula1`.`function` ( + `ID` int not null auto_increment, + `function` varchar(45) null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible); + +drop table if exists `formula1`.`member`; +create table if not exists `formula1`.`member` ( + `ID` int not null auto_increment, + `firstName` varchar(45) null default null, + `middleName` varchar(31) null default null, + `lastName` varchar(45) null default null, + `photo` mediumblob null default null, + `functionID` int null default null, + `membercol` varchar(45) null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible, + index `functionID_idx` (`functionID` asc) visible, + constraint `functionID` + foreign key (`functionID`) + references `formula1`.`function` (`ID`) + on update cascade); + +drop table if exists `formula1`.`specialposition`; +create table if not exists `formula1`.`specialposition` ( + `ID` int not null auto_increment, + `type` varchar(45) null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible); + +drop table if exists `formula1`.`endposition`; +create table if not exists `formula1`.`endposition` ( + `ID` int not null auto_increment, + `memberID` int null default null, + `position` int null default null, + `specialPoistionID` int null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible, + index `memberIDEndPosition_idx` (`memberID` asc) visible, + index `specialPositionID_idx` (`specialPoistionID` asc) visible, + constraint `memberIDEndPosition` + foreign key (`memberID`) + references `formula1`.`member` (`ID`) + on update cascade, + constraint `specialPositionID` + foreign key (`specialPoistionID`) + references `formula1`.`specialposition` (`ID`) + on update cascade); + +drop table if exists `formula1`.`fastestlap`; +create table if not exists `formula1`.`fastestlap` ( + `ID` int not null auto_increment, + `memberID` int null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible, + index `memberIDfastestlap_idx` (`memberID` asc) visible, + constraint `memberIDfastestlap` + foreign key (`memberID`) + references `formula1`.`member` (`ID`) + on update cascade); + +drop table if exists `formula1`.`racetype`; +create table if not exists `formula1`.`racetype` ( + `ID` int not null auto_increment, + `raceType` varchar(45) not null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible); + +drop table if exists `formula1`.`racedate`; +create table if not exists `formula1`.`racedate` ( + `ID` int not null auto_increment, + `calanderID` int null default null, + `raceTypeID` int null default null, + `week` int not null, + `date` date not null, + primary key (`ID`), + index `calanderID_idx` (`calanderID` asc) visible, + index `raceTypeID_idx` (`raceTypeID` asc) visible, + constraint `calanderID` + foreign key (`calanderID`) + references `formula1`.`calender` (`ID`) + on update cascade, + constraint `raceTypeID` + foreign key (`raceTypeID`) + references `formula1`.`racetype` (`ID`) + on update cascade); + +drop table if exists `formula1`.`race`; +create table if not exists `formula1`.`race` ( + `ID` int not null auto_increment, + `raceDateID` int null default null, + `raceNumber` int null default null, + `fastestLapID` int null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible, + unique index `raceNumber_UNIQUE` (`raceNumber` asc) visible, + index `raceDateID_idx` (`raceDateID` asc) visible, + index `fastestLapID_idx` (`fastestLapID` asc) visible, + constraint `fastestLapID` + foreign key (`fastestLapID`) + references `formula1`.`fastestlap` (`ID`) + on update cascade, + constraint `raceDateIDRace` + foreign key (`raceDateID`) + references `formula1`.`racedate` (`ID`) + on update cascade); + +drop table if exists `formula1`.`endpositionrace`; +create table if not exists `formula1`.`endpositionrace` ( + `ID` int not null auto_increment, + `endPositionID` int null default null, + `raceID` int null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible, + index `endPositionID_idx` (`endPositionID` asc) visible, + index `raceID_idx` (`raceID` asc) visible, + constraint `endPositionID` + foreign key (`endPositionID`) + references `formula1`.`endposition` (`ID`) + on update cascade, + constraint `raceID` + foreign key (`raceID`) + references `formula1`.`race` (`ID`) + on update cascade); + +drop table if exists `formula1`.`nationality`; +create table if not exists `formula1`.`nationality` ( + `ID` int not null auto_increment, + `country` varchar(45) null default null, + `flag` mediumblob null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible); + +drop table if exists `formula1`.`membernationality`; +create table if not exists `formula1`.`membernationality` ( + `ID` int not null auto_increment, + `memberID` int null default null, + `nationalityID` int null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible, + index `memberID_idx` (`memberID` asc) visible, + index `nationalityID_idx` (`nationalityID` asc) visible, + constraint `memberIDNationality` + foreign key (`memberID`) + references `formula1`.`member` (`ID`) + on update cascade, + constraint `nationalityID` + foreign key (`nationalityID`) + references `formula1`.`nationality` (`ID`) + on update cascade); + +drop table if exists `formula1`.`racedatecircuit`; +create table if not exists `formula1`.`racedatecircuit` ( + `ID` int not null auto_increment, + `raceDateID` int null default null, + `circuitID` int null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible, + index `circuitID_idx` (`circuitID` asc) visible, + index `raceDateID_idx` (`raceDateID` asc) visible, + constraint `circuitID` + foreign key (`circuitID`) + references `formula1`.`circuit` (`ID`) + on update cascade, + constraint `raceDateID` + foreign key (`raceDateID`) + references `formula1`.`racedate` (`ID`) + on update cascade); + +drop table if exists `formula1`.`teams`; +create table if not exists `formula1`.`teams` ( + `ID` int not null auto_increment, + `calanderID` int null default null, + `teamNumber` int null default null, + `teamName` varchar(45) null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible, + index `calanderID_idx` (`calanderID` asc) visible, + constraint `calanderID2` + foreign key (`calanderID`) + references `formula1`.`calender` (`ID`) + on update cascade); + +drop table if exists `formula1`.`teamsmember`; +create table if not exists `formula1`.`teamsmember` ( + `ID` int not null auto_increment, + `teamsID` int null default null, + `memberID` int null default null, + `teamsMembercol` varchar(45) null default null, + primary key (`ID`), + unique index `ID_UNIQUE` (`ID` asc) visible, + index `teamsID_idx` (`teamsID` asc) visible, + index `memberIDteams_idx` (`memberID` asc) visible, + constraint `memberIDteams` + foreign key (`memberID`) + references `formula1`.`member` (`ID`), + constraint `teamsID` + foreign key (`teamsID`) + references `formula1`.`teams` (`ID`)); + diff --git a/dbinit/import.py b/dbinit/import.py new file mode 100755 index 0000000..d8dbf66 --- /dev/null +++ b/dbinit/import.py @@ -0,0 +1 @@ +#!/bin/python3 diff --git a/dbinit/makefile b/dbinit/makefile new file mode 100644 index 0000000..d6ab70e --- /dev/null +++ b/dbinit/makefile @@ -0,0 +1,5 @@ +dbinit.sql: base.sql data.sql + cat $^ > $@ + +data.sql: + ./import.py > $@ diff --git a/formula1.sql b/formula1.sql deleted file mode 100644 index 5e85c95..0000000 --- a/formula1.sql +++ /dev/null @@ -1,370 +0,0 @@ --- MySQL Workbench Forward Engineering - -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; - --- ----------------------------------------------------- --- Schema mydb --- ----------------------------------------------------- --- ----------------------------------------------------- --- Schema formula1 --- ----------------------------------------------------- -DROP SCHEMA IF EXISTS `formula1` ; - --- ----------------------------------------------------- --- Schema formula1 --- ----------------------------------------------------- -CREATE SCHEMA IF NOT EXISTS `formula1` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ; -USE `formula1` ; - --- ----------------------------------------------------- --- Table `formula1`.`calender` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`calender` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`calender` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `year` YEAR NOT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE, - UNIQUE INDEX `year_UNIQUE` (`year` ASC) VISIBLE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`circuit` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`circuit` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`circuit` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `name` VARCHAR(45) NULL DEFAULT NULL, - `length` INT NULL DEFAULT NULL, - `photo` MEDIUMBLOB NULL DEFAULT NULL, - `laps` INT NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`function` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`function` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`function` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `function` VARCHAR(45) NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`member` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`member` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`member` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `firstName` VARCHAR(45) NULL DEFAULT NULL, - `middleName` VARCHAR(31) NULL DEFAULT NULL, - `lastName` VARCHAR(45) NULL DEFAULT NULL, - `photo` MEDIUMBLOB NULL DEFAULT NULL, - `functionID` INT NULL DEFAULT NULL, - `membercol` VARCHAR(45) NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE, - INDEX `functionID_idx` (`functionID` ASC) VISIBLE, - CONSTRAINT `functionID` - FOREIGN KEY (`functionID`) - REFERENCES `formula1`.`function` (`ID`) - ON UPDATE CASCADE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`specialposition` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`specialposition` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`specialposition` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `type` VARCHAR(45) NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`endposition` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`endposition` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`endposition` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `memberID` INT NULL DEFAULT NULL, - `position` INT NULL DEFAULT NULL, - `specialPoistionID` INT NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE, - INDEX `memberIDEndPosition_idx` (`memberID` ASC) VISIBLE, - INDEX `specialPositionID_idx` (`specialPoistionID` ASC) VISIBLE, - CONSTRAINT `memberIDEndPosition` - FOREIGN KEY (`memberID`) - REFERENCES `formula1`.`member` (`ID`) - ON UPDATE CASCADE, - CONSTRAINT `specialPositionID` - FOREIGN KEY (`specialPoistionID`) - REFERENCES `formula1`.`specialposition` (`ID`) - ON UPDATE CASCADE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`fastestlap` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`fastestlap` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`fastestlap` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `memberID` INT NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE, - INDEX `memberIDfastestlap_idx` (`memberID` ASC) VISIBLE, - CONSTRAINT `memberIDfastestlap` - FOREIGN KEY (`memberID`) - REFERENCES `formula1`.`member` (`ID`) - ON UPDATE CASCADE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`racetype` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`racetype` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`racetype` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `raceType` VARCHAR(45) NOT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`racedate` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`racedate` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`racedate` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `calanderID` INT NULL DEFAULT NULL, - `raceTypeID` INT NULL DEFAULT NULL, - `week` INT NOT NULL, - `date` DATE NOT NULL, - PRIMARY KEY (`ID`), - INDEX `calanderID_idx` (`calanderID` ASC) VISIBLE, - INDEX `raceTypeID_idx` (`raceTypeID` ASC) VISIBLE, - CONSTRAINT `calanderID` - FOREIGN KEY (`calanderID`) - REFERENCES `formula1`.`calender` (`ID`) - ON UPDATE CASCADE, - CONSTRAINT `raceTypeID` - FOREIGN KEY (`raceTypeID`) - REFERENCES `formula1`.`racetype` (`ID`) - ON UPDATE CASCADE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`race` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`race` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`race` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `raceDateID` INT NULL DEFAULT NULL, - `raceNumber` INT NULL DEFAULT NULL, - `fastestLapID` INT NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE, - UNIQUE INDEX `raceNumber_UNIQUE` (`raceNumber` ASC) VISIBLE, - INDEX `raceDateID_idx` (`raceDateID` ASC) VISIBLE, - INDEX `fastestLapID_idx` (`fastestLapID` ASC) VISIBLE, - CONSTRAINT `fastestLapID` - FOREIGN KEY (`fastestLapID`) - REFERENCES `formula1`.`fastestlap` (`ID`) - ON UPDATE CASCADE, - CONSTRAINT `raceDateIDRace` - FOREIGN KEY (`raceDateID`) - REFERENCES `formula1`.`racedate` (`ID`) - ON UPDATE CASCADE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`endpositionrace` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`endpositionrace` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`endpositionrace` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `endPositionID` INT NULL DEFAULT NULL, - `raceID` INT NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE, - INDEX `endPositionID_idx` (`endPositionID` ASC) VISIBLE, - INDEX `raceID_idx` (`raceID` ASC) VISIBLE, - CONSTRAINT `endPositionID` - FOREIGN KEY (`endPositionID`) - REFERENCES `formula1`.`endposition` (`ID`) - ON UPDATE CASCADE, - CONSTRAINT `raceID` - FOREIGN KEY (`raceID`) - REFERENCES `formula1`.`race` (`ID`) - ON UPDATE CASCADE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`nationality` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`nationality` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`nationality` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `country` VARCHAR(45) NULL DEFAULT NULL, - `flag` MEDIUMBLOB NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`membernationality` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`membernationality` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`membernationality` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `memberID` INT NULL DEFAULT NULL, - `nationalityID` INT NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE, - INDEX `memberID_idx` (`memberID` ASC) VISIBLE, - INDEX `nationalityID_idx` (`nationalityID` ASC) VISIBLE, - CONSTRAINT `memberIDNationality` - FOREIGN KEY (`memberID`) - REFERENCES `formula1`.`member` (`ID`) - ON UPDATE CASCADE, - CONSTRAINT `nationalityID` - FOREIGN KEY (`nationalityID`) - REFERENCES `formula1`.`nationality` (`ID`) - ON UPDATE CASCADE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`racedatecircuit` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`racedatecircuit` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`racedatecircuit` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `raceDateID` INT NULL DEFAULT NULL, - `circuitID` INT NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE, - INDEX `circuitID_idx` (`circuitID` ASC) VISIBLE, - INDEX `raceDateID_idx` (`raceDateID` ASC) VISIBLE, - CONSTRAINT `circuitID` - FOREIGN KEY (`circuitID`) - REFERENCES `formula1`.`circuit` (`ID`) - ON UPDATE CASCADE, - CONSTRAINT `raceDateID` - FOREIGN KEY (`raceDateID`) - REFERENCES `formula1`.`racedate` (`ID`) - ON UPDATE CASCADE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`teams` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`teams` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`teams` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `calanderID` INT NULL DEFAULT NULL, - `teamNumber` INT NULL DEFAULT NULL, - `teamName` VARCHAR(45) NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE, - INDEX `calanderID_idx` (`calanderID` ASC) VISIBLE, - CONSTRAINT `calanderID2` - FOREIGN KEY (`calanderID`) - REFERENCES `formula1`.`calender` (`ID`) - ON UPDATE CASCADE) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - --- ----------------------------------------------------- --- Table `formula1`.`teamsmember` --- ----------------------------------------------------- -DROP TABLE IF EXISTS `formula1`.`teamsmember` ; - -CREATE TABLE IF NOT EXISTS `formula1`.`teamsmember` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `teamsID` INT NULL DEFAULT NULL, - `memberID` INT NULL DEFAULT NULL, - `teamsMembercol` VARCHAR(45) NULL DEFAULT NULL, - PRIMARY KEY (`ID`), - UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE, - INDEX `teamsID_idx` (`teamsID` ASC) VISIBLE, - INDEX `memberIDteams_idx` (`memberID` ASC) VISIBLE, - CONSTRAINT `memberIDteams` - FOREIGN KEY (`memberID`) - REFERENCES `formula1`.`member` (`ID`), - CONSTRAINT `teamsID` - FOREIGN KEY (`teamsID`) - REFERENCES `formula1`.`teams` (`ID`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8mb4 -COLLATE = utf8mb4_0900_ai_ci; - - -SET SQL_MODE=@OLD_SQL_MODE; -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; @@ -3,3 +3,6 @@ ## links - [Ergast developer API](http://ergast.com/mrd/) +- [Driver images](https://brightspace.avans.nl/d2l/common/dialogs/quickLink/quickLink.d2l?ou=94181&type=coursefile&fileId=Coureurs.zip) +- [Country images](https://brightspace.avans.nl/d2l/common/dialogs/quickLink/quickLink.d2l?ou=94181&type=coursefile&fileId=Landen.zip) +- [Circuit images](https://brightspace.avans.nl/d2l/common/dialogs/quickLink/quickLink.d2l?ou=94181&type=coursefile&fileId=Circuits.zip) |