tippspiel2027/schema.sql

126 lines
4.9 KiB
MySQL
Raw Permalink Normal View History

2026-10-03 16:27:22 +02:00
DROP TABLE IF EXISTS `users`;
2026-10-03 15:56:22 +02:00
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(201) COLLATE utf8mb4_unicode_ci NOT NULL,
2026-10-03 16:06:05 +02:00
`firstname` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`lastname` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2026-10-03 15:56:22 +02:00
`email` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
2026-10-03 16:06:05 +02:00
`iban` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`bankname` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`blz` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`kontonr` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2026-10-03 15:56:22 +02:00
`mobile` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`deleted` timestamp NULL DEFAULT NULL,
`admin` tinyint(1) NOT NULL DEFAULT '0',
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2026-10-03 16:27:22 +02:00
DROP TABLE IF EXISTS `tipps`;
2026-10-03 15:56:22 +02:00
CREATE TABLE `tipps` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`game_id` int(11) NOT NULL,
`score1` int(11) NOT NULL,
`score2` int(11) NOT NULL,
`joker` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2026-10-03 16:27:22 +02:00
DROP TABLE IF EXISTS `games`;
2026-10-03 15:56:22 +02:00
CREATE TABLE `games` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`round_id` int(11) NOT NULL,
`team1` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`team2` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`score1` int(11) NOT NULL DEFAULT '-1',
`score2` int(11) NOT NULL DEFAULT '-1',
`kickoff` datetime NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2026-10-03 16:27:22 +02:00
DROP TABLE IF EXISTS `rounds`;
2026-10-03 15:56:22 +02:00
CREATE TABLE `rounds` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
`season_id` int(11) NOT NULL,
2026-10-03 16:06:05 +02:00
`report` text COLLATE utf8mb4_unicode_ci,
2026-10-03 15:56:22 +02:00
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2026-10-03 16:27:22 +02:00
DROP TABLE IF EXISTS `seasons`;
2026-10-03 15:56:22 +02:00
CREATE TABLE `seasons` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`rounds` int(11) NOT NULL DEFAULT '36',
`active` tinyint(1) NOT NULL DEFAULT '1',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2026-10-03 16:27:22 +02:00
DROP TABLE IF EXISTS `settings`;
CREATE TABLE `settings` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`current_season_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `payments`;
CREATE TABLE `payments` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`season_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`paid_date` datetime DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `quotas`;
CREATE TABLE `quotas` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`season_id` int(11) NOT NULL DEFAULT '0',
`name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`prc` double NOT NULL DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `roundmails`;
CREATE TABLE `roundmails` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`send_date` date NOT NULL,
`recipients` text COLLATE utf8mb4_unicode_ci NOT NULL,
`topic` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
`message` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `manual_payouts`;
CREATE TABLE `manual_payouts` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`season_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`quota_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;