CREATE TABLE IF NOT EXISTS `log` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NULL,
`level` VARCHAR(50) NOT NULL,
`message` TEXT NOT NULL,
`data` TEXT NULL,
`method` VARCHAR(50) NULL,
`url` TEXT NULL,
`file` TEXT NULL,
`line` INT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
0.39 ms
|
CREATE TABLE IF NOT EXISTS `images` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`type` VARCHAR(100) NOT NULL,
`name` VARCHAR(100) NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `user_codes` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`code_type_id` BIGINT UNSIGNED NOT NULL,
`code` VARCHAR(255) NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `statuses` (
`id` SERIAL PRIMARY KEY NOT NULL,
`name` VARCHAR(255) NOT NULL UNIQUE,
`name_de` VARCHAR(100) NOT NULL,
`name_en` VARCHAR(100) NOT NULL,
`verification_type` VARCHAR(50) NOT NULL,
`visibility` VARCHAR(50) NOT NULL,
`info_de` TEXT NULL,
`info_en` TEXT NULL,
`document_de` VARCHAR(255) NULL,
`document_en` VARCHAR(255) NULL,
`notes` TEXT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
`deleted_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `users_statuses` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`status_id` BIGINT UNSIGNED NOT NULL,
`status_verified` BOOLEAN NULL,
`verification_expiration` DATE NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `code_types` (
`id` SERIAL PRIMARY KEY NOT NULL,
`name` VARCHAR(100) NOT NULL UNIQUE,
`description` VARCHAR(255) NULL,
`expires_after` VARCHAR(50) NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `verification_documents` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_status_id` BIGINT UNSIGNED NOT NULL,
`display_name` VARCHAR(255) NOT NULL,
`type` VARCHAR(100) NOT NULL,
`name` VARCHAR(100) NOT NULL,
`status` VARCHAR(50) NOT NULL,
`comment` TEXT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `consent_forms` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`display_name` VARCHAR(255) NOT NULL,
`type` VARCHAR(100) NOT NULL,
`name` VARCHAR(100) NOT NULL,
`status` VARCHAR(50) NOT NULL,
`comment` TEXT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `price_cats` (
`id` SERIAL PRIMARY KEY NOT NULL,
`name` VARCHAR(100) NOT NULL UNIQUE,
`name_de` VARCHAR(100) NOT NULL,
`name_en` VARCHAR(100) NOT NULL,
`description` TEXT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
`deleted_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `status_price_cats` (
`id` SERIAL PRIMARY KEY NOT NULL,
`status_id` BIGINT UNSIGNED NOT NULL UNIQUE,
`price_cat_id` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `cards` (
`id` SERIAL PRIMARY KEY NOT NULL,
`name_de` VARCHAR(100) NOT NULL,
`name_en` VARCHAR(100) NOT NULL,
`exclude_guests` BOOLEAN NOT NULL,
`description_de` TEXT NULL,
`description_en` TEXT NULL,
`min_duration` VARCHAR(50) NULL,
`min_age` INT NULL,
`max_age` INT NULL,
`subscription` BOOLEAN NOT NULL,
`require_group` BIGINT(20) NULL,
`usable` INT NULL,
`dead_time` INT NULL,
`creates_qr` INT NOT NULL,
`amount_limit` INT NULL,
`active` BOOLEAN NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
`deleted_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `card_groups` (
`id` SERIAL PRIMARY KEY NOT NULL,
`name_de` VARCHAR(100) NOT NULL,
`name_en` VARCHAR(100) NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `card_group_memberships` (
`id` SERIAL PRIMARY KEY NOT NULL,
`card_group_id` BIGINT UNSIGNED NOT NULL,
`card_id` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `card_bookings` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`card_id` BIGINT UNSIGNED NOT NULL,
`valid_from` DATE NULL,
`valid_until` DATE NULL,
`sub_cancelled_at` DATE NULL,
`usable` INT NULL,
`purchase_id` BIGINT UNSIGNED NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
`deleted_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `tags` (
`id` SERIAL PRIMARY KEY NOT NULL,
`name_de` VARCHAR(100) NOT NULL,
`name_en` VARCHAR(100) NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `places` (
`id` SERIAL PRIMARY KEY NOT NULL,
`name_de` VARCHAR(100) NOT NULL,
`name_en` VARCHAR(100) NOT NULL,
`description` TEXT NULL,
`capacity` INT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `course_cards` (
`id` SERIAL PRIMARY KEY NOT NULL,
`course_id` BIGINT UNSIGNED NOT NULL,
`card_group_id` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `course_tags` (
`id` SERIAL PRIMARY KEY NOT NULL,
`tag_id` BIGINT UNSIGNED NOT NULL,
`course_id` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `course_statuses` (
`id` SERIAL PRIMARY KEY NOT NULL,
`status_id` BIGINT UNSIGNED NOT NULL,
`course_id` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `course_dates` (
`id` SERIAL PRIMARY KEY NOT NULL,
`course_id` BIGINT UNSIGNED NOT NULL,
`start` DATETIME NOT NULL,
`end` DATETIME NOT NULL,
`place_id` BIGINT UNSIGNED NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
`deleted_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `course_date_instructors` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`course_date_id` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `course_bookings` (
`id` SERIAL PRIMARY KEY NOT NULL,
`course_date_id` BIGINT UNSIGNED NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`status` VARCHAR(100) NULL,
`purchase_id` BIGINT UNSIGNED NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
`deleted_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `course_options` (
`id` SERIAL PRIMARY KEY NOT NULL,
`course_id` BIGINT UNSIGNED NOT NULL,
`type` VARCHAR(50) NOT NULL,
`prompt_de` TEXT NOT NULL,
`prompt_en` TEXT NOT NULL,
`options_de` TEXT NULL,
`options_en` TEXT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `products` (
`id` SERIAL PRIMARY KEY NOT NULL,
`course_id` BIGINT UNSIGNED NULL,
`card_id` BIGINT UNSIGNED NULL,
`kostenstelle` VARCHAR(7) NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `product_prices` (
`id` SERIAL PRIMARY KEY NOT NULL,
`product_id` BIGINT UNSIGNED NULL,
`price_cat_id` BIGINT UNSIGNED NOT NULL,
`taxrate` NUMERIC(15,2) NOT NULL,
`amount` NUMERIC(15,2) NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `course_booking_options` (
`id` SERIAL PRIMARY KEY NOT NULL,
`course_booking_id` BIGINT UNSIGNED NOT NULL,
`course_option_id` BIGINT UNSIGNED NOT NULL,
`response` TEXT NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `purchases` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`product_price_id` BIGINT UNSIGNED NOT NULL,
`payment_state` VARCHAR(13) NOT NULL,
`refund_state` VARCHAR(20) NOT NULL,
`payment_method` VARCHAR(255) NOT NULL,
`cancelled_at` DATETIME NULL,
`note` TEXT NULL,
`suggested_refund` NUMERIC(15,2) NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `refunds` (
`id` SERIAL PRIMARY KEY NOT NULL,
`purchase_id` BIGINT UNSIGNED NOT NULL,
`amount` NUMERIC(15,2) NOT NULL,
`release_date` DATE NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `users` (
`id` SERIAL PRIMARY KEY NOT NULL,
`account` VARCHAR(50) NULL,
`email` VARCHAR(100) NULL,
`password` VARCHAR(100) NULL,
`is_guest_account` BOOLEAN NOT NULL,
`first_name` VARCHAR(100) NULL,
`last_name` VARCHAR(100) NULL,
`street` VARCHAR(255) NULL,
`post_code` VARCHAR(50) NULL,
`city` VARCHAR(100) NULL,
`gender` SET("MALE", "FEMALE", "OTHER") NULL,
`birthday` DATE NULL,
`phone` VARCHAR(50) NULL,
`language` VARCHAR(10) NULL,
`recovery_email` VARCHAR(100) NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
`deleted_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `children_parents` (
`id` SERIAL PRIMARY KEY NOT NULL,
`parent_id` BIGINT UNSIGNED NOT NULL,
`child_id` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `courses` (
`id` SERIAL PRIMARY KEY NOT NULL,
`template_name` VARCHAR(100) NULL,
`type` VARCHAR(50) NOT NULL,
`name_de` VARCHAR(255) NOT NULL,
`name_en` VARCHAR(255) NOT NULL,
`min_age` INT NULL,
`max_age` INT NULL,
`allowed_genders` VARCHAR(10) NULL,
`max_participants` INT NULL,
`visible_from` DATETIME NULL,
`visible_until` DATETIME NULL,
`bookable_from` DATETIME NULL,
`bookable_until` DATETIME NULL,
`info_de` TEXT NULL,
`info_en` TEXT NULL,
`book_text_de` TEXT NULL,
`book_text_en` TEXT NULL,
`default_mail_sender_id` BIGINT UNSIGNED NULL,
`level` VARCHAR(100) NULL,
`campus` VARCHAR(100) NULL,
`active` BOOLEAN NOT NULL,
`registration_type` VARCHAR(50) NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
`deleted_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `email_addresses` (
`id` SERIAL PRIMARY KEY NOT NULL,
`address` VARCHAR(100) NOT NULL,
`description` TEXT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `booking_qr_codes` (
`id` SERIAL PRIMARY KEY NOT NULL,
`booking_id` BIGINT UNSIGNED NOT NULL,
`hash` VARCHAR(64) NOT NULL,
`parent_ticket` BOOLEAN NOT NULL,
`last_used` DATETIME NULL,
`rand_number` INT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `facilities` (
`id` SERIAL PRIMARY KEY NOT NULL,
`name_de` VARCHAR(255) NOT NULL,
`name_en` VARCHAR(255) NOT NULL,
`max_capacity` INT NOT NULL,
`description_de` TEXT NULL,
`description_en` TEXT NULL,
`explanation_de` TEXT NULL,
`explanation_en` TEXT NULL,
`campus` VARCHAR(50) NOT NULL,
`opening_start` TIME NOT NULL,
`opening_end` TIME NOT NULL,
`weekly_quota` INT NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
`deleted_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `timeslots` (
`id` SERIAL PRIMARY KEY NOT NULL,
`facility_id` BIGINT UNSIGNED NOT NULL,
`start` DATETIME NOT NULL,
`capacity` INT NOT NULL,
`closed` BOOLEAN NOT NULL,
`comment` TEXT NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `reservations` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`timeslot_id` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `quotas` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`facility_id` BIGINT UNSIGNED NOT NULL,
`week` VARCHAR(7) NOT NULL,
`quota` INT NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `checkins` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`facility_id` BIGINT UNSIGNED NOT NULL,
`start_time` DATETIME NOT NULL,
`end_time` DATETIME NOT NULL,
`parent` BOOLEAN NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `facility_card_groups` (
`id` SERIAL PRIMARY KEY NOT NULL,
`facility_id` BIGINT UNSIGNED NOT NULL,
`card_group_id` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `required_approvals` (
`id` SERIAL PRIMARY KEY NOT NULL,
`name_de` VARCHAR(255) NOT NULL,
`name_en` VARCHAR(255) NOT NULL,
`text_de` TEXT NOT NULL,
`text_en` TEXT NOT NULL,
`link_de` VARCHAR(255) NOT NULL,
`link_en` VARCHAR(255) NOT NULL,
`accept_text_de` TEXT NOT NULL,
`accept_text_en` TEXT NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `user_approvals` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`required_approval_id` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `muttizettels` (
`id` SERIAL PRIMARY KEY NOT NULL,
`parent_id` BIGINT UNSIGNED NOT NULL,
`child_id` BIGINT UNSIGNED NOT NULL,
`parent_phone` VARCHAR(255) NOT NULL,
`child_phone` VARCHAR(255) NULL,
`first_name` VARCHAR(255) NULL,
`last_name` VARCHAR(255) NULL,
`birthday` DATE NULL,
`street` VARCHAR(255) NULL,
`post_code` VARCHAR(255) NULL,
`city` VARCHAR(255) NULL,
`phone` VARCHAR(255) NULL,
`valid_until` DATE NULL,
`no_supervision` BOOLEAN NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL,
`deleted_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `admin_qr_codes` (
`id` SERIAL PRIMARY KEY NOT NULL,
`card_id` BIGINT UNSIGNED NOT NULL,
`hash` VARCHAR(64) NOT NULL,
`usable` INT NULL,
`valid_from` DATETIME NULL,
`valid_until` DATETIME NULL,
`user_id` BIGINT UNSIGNED NULL,
`needs_activation` BOOLEAN NOT NULL,
`comment` VARCHAR(255) NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `favourites` (
`id` SERIAL PRIMARY KEY NOT NULL,
`user_id` BIGINT UNSIGNED NOT NULL,
`course_id` BIGINT UNSIGNED NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
CREATE TABLE IF NOT EXISTS `parent_requests` (
`id` SERIAL PRIMARY KEY NOT NULL,
`requester_id` BIGINT UNSIGNED NOT NULL,
`requested_id` BIGINT UNSIGNED NOT NULL,
`child_id` BIGINT UNSIGNED NOT NULL,
`status` VARCHAR(50) NOT NULL,
`created_at` TIMESTAMP NULL,
`updated_at` TIMESTAMP NULL
); |
--- ms
|
SELECT * FROM `statuses` WHERE visibility = "all" AND deleted_at IS NULL |
--- ms
|