Added tables

master
Florian Meissner 2023-08-25 18:13:19 +02:00
parent fa08774aed
commit 64694e1d34
13 changed files with 490 additions and 0 deletions

Binary file not shown.

View File

@ -87,7 +87,11 @@ END
$
DELIMITER ;
START TRANSACTION;
-- Call procedure
CALL CREATE_USER('root');
CALL CREATE_USER('eaBackend');
CALL CREATE_USER('checkmk');
COMMIT;

View File

@ -33,3 +33,5 @@ SET time_zone = "+00:00";
CREATE DATABASE IF NOT EXISTS `eaMain` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `eaMain`;
COMMIT;

View File

@ -0,0 +1,55 @@
-- ****************************************************************************************************
-- * ______ _ _ *
-- * | ____| /\ (_) | | *
-- * | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
-- * | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
-- * | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
-- * |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
-- * | | | | *
-- * |_| |_| *
-- * *
-- ****************************************************************************************************
-- This file is part of the European Airports Project, a free, collaborative platform of airport data
-- extending beyond the official AIPs.
-- Copyright (C) 2023
-- Florian Meissner <florianmeissner@gmx.de>
-- This program is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details. You should have received a copy of the GNU General Public License along with this program.
-- (license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
USE eaMain;
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `airports` (
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
`icao` CHAR(4) UNIQUE,
`ident` VARCHAR(6) NOT NULL UNIQUE COMMENT 'Local identifier',
`iata` CHAR(3),
`name` VARCHAR(100) NOT NULL,
`type` ENUM('B', 'G', 'H', 'I', 'N', 'U') NOT NULL,
`lat` DECIMAL(7, 2) NOT NULL COMMENT 'degrees',
`lon` DECIMAL(8, 2) NOT NULL COMMENT 'degrees',
`continent` ENUM('AF', 'AN', 'AS', 'CA', 'EU', 'NA', 'OC', 'SA') DEFAULT 'EU' NOT NULL,
`country` CHAR(2) DEFAULT 'ZZ' NOT NULL COMMENT 'ISO 3166-1 alpha-2 identifier',
`region` CHAR(5) COMMENT 'ISO 3166-2 identifier',
`city` VARCHAR(100),
CONSTRAINT `airports.hasIdent` CHECK (
NOT (
`icao` IS NULL
AND `ident` IS NULL
AND `iata` IS NULL
)
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
COMMIT;

45
init/02-ddl/10-users.sql Normal file
View File

@ -0,0 +1,45 @@
-- ****************************************************************************************************
-- * ______ _ _ *
-- * | ____| /\ (_) | | *
-- * | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
-- * | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
-- * | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
-- * |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
-- * | | | | *
-- * |_| |_| *
-- * *
-- ****************************************************************************************************
-- This file is part of the European Airports Project, a free, collaborative platform of airport data
-- extending beyond the official AIPs.
-- Copyright (C) 2023
-- Florian Meissner <florianmeissner@gmx.de>
-- This program is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details. You should have received a copy of the GNU General Public License along with this program.
-- (license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
USE eaMain;
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `users` (
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
`username` VARCHAR(30) NOT NULL UNIQUE,
`email` VARCHAR(100) NOT NULL UNIQUE,
`firstName` VARCHAR(100),
`lastName` VARCHAR(100),
`password` CHAR(64) NOT NULL COMMENT 'sha512',
`salt` UUID NOT NULL DEFAULT SYS_GUID(),
`active` BOOLEAN DEFAULT TRUE,
`sysUser` BOOLEAN DEFAULT FALSE,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='User data; Avatars saved on disk as <id>.jpg';
COMMIT;

View File

@ -0,0 +1,48 @@
-- ****************************************************************************************************
-- * ______ _ _ *
-- * | ____| /\ (_) | | *
-- * | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
-- * | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
-- * | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
-- * |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
-- * | | | | *
-- * |_| |_| *
-- * *
-- ****************************************************************************************************
-- This file is part of the European Airports Project, a free, collaborative platform of airport data
-- extending beyond the official AIPs.
-- Copyright (C) 2023
-- Florian Meissner <florianmeissner@gmx.de>
-- This program is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details. You should have received a copy of the GNU General Public License along with this program.
-- (license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
USE eaMain;
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `airportComments` (
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
`author` INT UNSIGNED NOT NULL,
`airport` INT UNSIGNED NOT NULL,
`createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
`changedAt` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
`title` VARCHAR(200),
`message` TEXT NOT NULL,
`hidden` BOOLEAN NOT NULL DEFAULT FALSE,
`ref` INT UNSIGNED COMMENT 'reference to a previous comment',
CONSTRAINT `airportComments.fk_author` FOREIGN KEY (`author`) REFERENCES users(id),
CONSTRAINT `airportComments.fk_airport` FOREIGN KEY (`airport`) REFERENCES airports(id),
CONSTRAINT `airportComments.fk_ref` FOREIGN KEY (`ref`) REFERENCES airportComments(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
COMMIT;

View File

@ -0,0 +1,45 @@
-- ****************************************************************************************************
-- * ______ _ _ *
-- * | ____| /\ (_) | | *
-- * | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
-- * | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
-- * | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
-- * |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
-- * | | | | *
-- * |_| |_| *
-- * *
-- ****************************************************************************************************
-- This file is part of the European Airports Project, a free, collaborative platform of airport data
-- extending beyond the official AIPs.
-- Copyright (C) 2023
-- Florian Meissner <florianmeissner@gmx.de>
-- This program is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details. You should have received a copy of the GNU General Public License along with this program.
-- (license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
USE eaMain;
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `airportFrequencies` (
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
`airport` INT UNSIGNED NOT NULL,
`type` ENUM(
'A/A', 'A/G', 'AFIS', 'APP', 'ATIS', 'CNTR', 'CTAF', 'DEL', 'DEP', 'DIR', 'FIS',
'GND', 'MISC', 'PRE', 'UNIC', 'TWR')
NOT NULL DEFAULT 'MISC',
`callsign` VARCHAR(30) NOT NULL,
`frequency` DECIMAL(6, 3) NOT NULL COMMENT 'MHz',
CONSTRAINT `airportFrequencies.fk_airport` FOREIGN KEY (`airport`) REFERENCES airports(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
COMMIT;

View File

@ -0,0 +1,46 @@
-- ****************************************************************************************************
-- * ______ _ _ *
-- * | ____| /\ (_) | | *
-- * | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
-- * | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
-- * | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
-- * |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
-- * | | | | *
-- * |_| |_| *
-- * *
-- ****************************************************************************************************
-- This file is part of the European Airports Project, a free, collaborative platform of airport data
-- extending beyond the official AIPs.
-- Copyright (C) 2023
-- Florian Meissner <florianmeissner@gmx.de>
-- This program is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details. You should have received a copy of the GNU General Public License along with this program.
-- (license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
USE eaMain;
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `airportPhones` (
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
`airport` INT UNSIGNED NOT NULL,
`phoneNumber` VARCHAR(30) NOT NULL,
`type` ENUM('OPS', 'PPR', 'OPR', 'CUST', 'FUEL', 'CLUB', 'OTH') NOT NULL DEFAULT 'OTH',
`reportedBy` INT UNSIGNED NOT NULL,
`reportedAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
`active` BOOLEAN NOT NULL DEFAULT TRUE,
`description` TEXT,
CONSTRAINT `airportPhones.fk_airport` FOREIGN KEY (`airport`) REFERENCES airports(id)
CONSTRAINT `airportPhones.fk_reportedBy` FOREIGN KEY (`reportedBy`) REFERENCES users(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
COMMIT;

View File

@ -0,0 +1,41 @@
-- ****************************************************************************************************
-- * ______ _ _ *
-- * | ____| /\ (_) | | *
-- * | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
-- * | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
-- * | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
-- * |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
-- * | | | | *
-- * |_| |_| *
-- * *
-- ****************************************************************************************************
-- This file is part of the European Airports Project, a free, collaborative platform of airport data
-- extending beyond the official AIPs.
-- Copyright (C) 2023
-- Florian Meissner <florianmeissner@gmx.de>
-- This program is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details. You should have received a copy of the GNU General Public License along with this program.
-- (license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
USE eaMain;
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `airportWebsites` (
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
`airport` INT UNSIGNED NOT NULL,
`url` VARCHAR(255) NOT NULL,
`title` VARCHAR(255),
CONSTRAINT `airportWebsites.fk_airport` FOREIGN KEY (`airport`) REFERENCES airports(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
COMMIT;

View File

@ -0,0 +1,52 @@
-- ****************************************************************************************************
-- * ______ _ _ *
-- * | ____| /\ (_) | | *
-- * | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
-- * | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
-- * | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
-- * |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
-- * | | | | *
-- * |_| |_| *
-- * *
-- ****************************************************************************************************
-- This file is part of the European Airports Project, a free, collaborative platform of airport data
-- extending beyond the official AIPs.
-- Copyright (C) 2023
-- Florian Meissner <florianmeissner@gmx.de>
-- This program is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details. You should have received a copy of the GNU General Public License along with this program.
-- (license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
USE eaMain;
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `amenities` (
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
`airport` INT UNSIGNED NOT NULL,
`type` ENUM('CAMP', 'HANG', 'SQ', 'REST', 'SH', 'TIE', 'OTH', 'CUST', 'IM', 'WC')
NOT NULL DEFAULT 'OTH',
`price` DECIMAL(6, 2),
`reportedBy` INT UNSIGNED NOT NULL,
`reportedAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
`available` BOOLEAN NOT NULL DEFAULT TRUE,
`contactName` VARCHAR(100),
`contactPhone` VARCHAR(30),
`contactMail` VARCHAR(100),
`contactUrl` VARCHAR(100),
`description` TEXT,
`priorNotice` VARCHAR(20),
CONSTRAINT `amenities.fk_reportedBy` FOREIGN KEY (`reportedBy`) REFERENCES users(id),
CONSTRAINT `amenities.fk_airport` FOREIGN KEY (`airport`) REFERENCES airports(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
COMMIT;

47
init/02-ddl/20-fuel.sql Normal file
View File

@ -0,0 +1,47 @@
-- ****************************************************************************************************
-- * ______ _ _ *
-- * | ____| /\ (_) | | *
-- * | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
-- * | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
-- * | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
-- * |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
-- * | | | | *
-- * |_| |_| *
-- * *
-- ****************************************************************************************************
-- This file is part of the European Airports Project, a free, collaborative platform of airport data
-- extending beyond the official AIPs.
-- Copyright (C) 2023
-- Florian Meissner <florianmeissner@gmx.de>
-- This program is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details. You should have received a copy of the GNU General Public License along with this program.
-- (license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
USE eaMain;
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `fuel` (
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
`airport` INT UNSIGNED NOT NULL,
`type` ENUM('A1', '100LL', 'UL91', 'DIESEL', 'MOGAS', 'OTH') NOT NULL DEFAULT 'OTH',
`price` DECIMAL(4, 2) NOT NULL COMMENT '€/L',
`priceDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
`priceSource` ENUM('EDDH', 'SkyDemon', 'ForeFlight', 'AeroPS', 'AirBP', 'Total', 'User') NOT NULL,
`reportedBy` INT UNSIGNED,
`paymentOptions` ENUM('AirBP', 'Total', 'Cash', 'Debit', 'Credit', 'Swish', 'Other'),
`paymentOptionsOther` VARCHAR(50),
CONSTRAINT `fuel.fk_airport` FOREIGN KEY (`airport`) REFERENCES airports(id)
CONSTRAINT `fuel.fk_reportedBy` FOREIGN KEY (`reportedBy`) REFERENCES users(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
COMMIT;

View File

@ -0,0 +1,57 @@
-- ****************************************************************************************************
-- * ______ _ _ *
-- * | ____| /\ (_) | | *
-- * | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
-- * | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
-- * | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
-- * |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
-- * | | | | *
-- * |_| |_| *
-- * *
-- ****************************************************************************************************
-- This file is part of the European Airports Project, a free, collaborative platform of airport data
-- extending beyond the official AIPs.
-- Copyright (C) 2023
-- Florian Meissner <florianmeissner@gmx.de>
-- This program is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details. You should have received a copy of the GNU General Public License along with this program.
-- (license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
USE eaMain;
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `runways` (
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
`airport` INT UNSIGNED NOT NULL,
`length` MEDIUMINT UNSIGNED NOT NULL COMMENT 'meters',
`width` SMALLINT UNSIGNED NOT NULL COMMENT 'meters',
`surface` ENUM('ASP', 'BIT', 'BRI', 'CLA', 'COM', 'CON', 'COP', 'COR', 'GRE', 'GRS', 'GVL',
'ICE', 'LAT', 'MAC', 'PEM', 'PER', 'PSP', 'SAN', 'SMT', 'SNO', 'U', 'WAT') NOT NULL DEFAULT 'U',
`lighted` BOOLEAN NOT NULL DEFAULT FALSE,
`closed` BOOLEAN NOT NULL DEFAULT FALSE,
`leIdent` VARCHAR(3) NOT NULL COMMENT 'runway designator',
`leLat` DECIMAL(7, 2) NOT NULL COMMENT 'degrees',
`leLon` DECIMAL(8, 2) NOT NULL COMMENT 'degrees',
`leElev` FLOAT(7, 3) NOT NULL COMMENT 'meters',
`leHdg` MEDIUMINT UNSIGNED NOT NULL COMMENT 'degrees',
`leDisplThres` MEDIUMINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'meters',
`heIdent` VARCHAR(3) NOT NULL COMMENT 'runway designator',
`heLat` DECIMAL(7, 2) NOT NULL COMMENT 'degrees',
`heLon` DECIMAL(8, 2) NOT NULL COMMENT 'degrees',
`heElev` FLOAT(7, 3) NOT NULL COMMENT 'meters',
`heHdg` MEDIUMINT UNSIGNED NOT NULL COMMENT 'degrees',
`heDisplThres` MEDIUMINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'meters',
CONSTRAINT `runways.fk_airport` FOREIGN KEY (`airport`) REFERENCES airports(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='le=low end; he=high end';
COMMIT;

48
init/02-ddl/30-photos.sql Normal file
View File

@ -0,0 +1,48 @@
-- ****************************************************************************************************
-- * ______ _ _ *
-- * | ____| /\ (_) | | *
-- * | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
-- * | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
-- * | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
-- * |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
-- * | | | | *
-- * |_| |_| *
-- * *
-- ****************************************************************************************************
-- This file is part of the European Airports Project, a free, collaborative platform of airport data
-- extending beyond the official AIPs.
-- Copyright (C) 2023
-- Florian Meissner <florianmeissner@gmx.de>
-- This program is free software: you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software Foundation, either
-- version 3 of the License, or (at your option) any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-- details. You should have received a copy of the GNU General Public License along with this program.
-- (license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
USE eaMain;
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `photos` (
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
`airport` INT UNSIGNED NOT NULL,
`uploadedBy` INT UNSIGNED NOT NULL,
`uploadedAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
`title` VARCHAR(200),
`description` TEXT NOT NULL,
`runway` INT UNSIGNED,
`category` BIT(8) NOT NULL DEFAULT 0b00000000,
`hidden` BOOLEAN NOT NULL DEFAULT FALSE,
CONSTRAINT `photos.fk_uploadedBy` FOREIGN KEY (`uploadedBy`) REFERENCES users(id),
CONSTRAINT `photos.fk_airport` FOREIGN KEY (`airport`) REFERENCES airports(id),
CONSTRAINT `photos.fk_runway` FOREIGN KEY (`runway`) REFERENCES runways(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
COMMIT;