Files
pokeval/sql_database/create_tables.sql
2025-04-28 00:04:14 +02:00

121 lines
5.7 KiB
SQL

-- --------------------------------------------------------
-- Host: 10.10.5.31
-- Server-Version: 8.0.41-0ubuntu0.24.04.1 - (Ubuntu)
-- Server-Betriebssystem: Linux
-- HeidiSQL Version: 12.10.0.7000
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-- Exportiere Datenbank-Struktur für pokevalv2
CREATE DATABASE IF NOT EXISTS `pokevalv2` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `pokevalv2`;
-- Exportiere Struktur von Tabelle pokevalv2.attributekeys
CREATE TABLE IF NOT EXISTS `attributekeys` (
`attributekeys_id` int NOT NULL AUTO_INCREMENT,
`attributekeys_name` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL,
`datatype` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL,
`is_required` tinyint(1) DEFAULT '0',
PRIMARY KEY (`attributekeys_id`) USING BTREE,
UNIQUE KEY `attributekey_name` (`attributekeys_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Daten-Export vom Benutzer nicht ausgewählt
-- Exportiere Struktur von Tabelle pokevalv2.attributes
CREATE TABLE IF NOT EXISTS `attributes` (
`attributes_id` int NOT NULL AUTO_INCREMENT,
`attributes_card` int NOT NULL,
`attributes_key` int NOT NULL,
`attributes_value` json DEFAULT NULL,
PRIMARY KEY (`attributes_id`),
KEY `FK_attributes_cards` (`attributes_card`),
KEY `FK_attributes_attributekeys` (`attributes_key`),
CONSTRAINT `FK_attributes_attributekeys` FOREIGN KEY (`attributes_key`) REFERENCES `attributekeys` (`attributekeys_id`),
CONSTRAINT `FK_attributes_cards` FOREIGN KEY (`attributes_card`) REFERENCES `cards` (`cards_id`),
CONSTRAINT `attributes_chk_1` CHECK (json_valid(`attributes_value`))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Daten-Export vom Benutzer nicht ausgewählt
-- Exportiere Struktur von Tabelle pokevalv2.auctions
CREATE TABLE IF NOT EXISTS `auctions` (
`auctions_id` int NOT NULL AUTO_INCREMENT,
`auctions_card` int DEFAULT NULL,
`auctions_currency` int DEFAULT NULL,
`auctions_platform` int DEFAULT NULL,
`auctions_price` decimal(10,2) DEFAULT NULL,
`auctions_datesold` datetime DEFAULT NULL,
`auctions_link` longtext COLLATE utf8mb4_general_ci,
PRIMARY KEY (`auctions_id`),
KEY `FK_auctions_cards` (`auctions_card`),
KEY `FK_auctions_currency` (`auctions_currency`),
KEY `FK_auctions_platforms` (`auctions_platform`),
CONSTRAINT `FK_auctions_cards` FOREIGN KEY (`auctions_card`) REFERENCES `cards` (`cards_id`),
CONSTRAINT `FK_auctions_currency` FOREIGN KEY (`auctions_currency`) REFERENCES `currency` (`currency_id`),
CONSTRAINT `FK_auctions_platforms` FOREIGN KEY (`auctions_platform`) REFERENCES `platforms` (`platforms_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Daten-Export vom Benutzer nicht ausgewählt
-- Exportiere Struktur von Tabelle pokevalv2.auctionsattributes
CREATE TABLE IF NOT EXISTS `auctionsattributes` (
`auctionsattributes_id` int NOT NULL AUTO_INCREMENT,
`auctionsattributes_auction` int DEFAULT NULL,
`auctionsattributes_key` int DEFAULT NULL,
`auctionsattributes_value` json DEFAULT NULL,
PRIMARY KEY (`auctionsattributes_id`),
KEY `FK_auctionsattributes_auctions` (`auctionsattributes_auction`),
KEY `FK_auctionsattributes_attributekeys` (`auctionsattributes_key`),
CONSTRAINT `FK_auctionsattributes_attributekeys` FOREIGN KEY (`auctionsattributes_key`) REFERENCES `attributekeys` (`attributekeys_id`),
CONSTRAINT `FK_auctionsattributes_auctions` FOREIGN KEY (`auctionsattributes_auction`) REFERENCES `auctions` (`auctions_id`),
CONSTRAINT `auctionsattributes_chk_1` CHECK (json_valid(`auctionsattributes_value`))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Daten-Export vom Benutzer nicht ausgewählt
-- Exportiere Struktur von Tabelle pokevalv2.cards
CREATE TABLE IF NOT EXISTS `cards` (
`cards_id` int NOT NULL AUTO_INCREMENT,
`cards_number` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL,
`cards_name` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL,
PRIMARY KEY (`cards_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Daten-Export vom Benutzer nicht ausgewählt
-- Exportiere Struktur von Tabelle pokevalv2.currency
CREATE TABLE IF NOT EXISTS `currency` (
`currency_id` int NOT NULL AUTO_INCREMENT,
`currency_name` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL,
`currency_symbol` varchar(2) COLLATE utf8mb4_general_ci DEFAULT NULL,
PRIMARY KEY (`currency_id`),
UNIQUE KEY `currency_name` (`currency_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Daten-Export vom Benutzer nicht ausgewählt
-- Exportiere Struktur von Tabelle pokevalv2.platforms
CREATE TABLE IF NOT EXISTS `platforms` (
`platforms_id` int NOT NULL AUTO_INCREMENT,
`platforms_name` varchar(250) COLLATE utf8mb4_general_ci DEFAULT NULL,
PRIMARY KEY (`platforms_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Daten-Export vom Benutzer nicht ausgewählt
/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;