Files
Aurora.3/SQL/migrate-2017/V057__cargo_logging_table.sql
Werner a69a7316ab Condense Database Migrations (#17103)
* Condense Database Migrations

Condenses the Database Migrations into a new initial schema.
Also adds some instructions to the Database Readme for existing setups.

* Update readme/delete changed migrations since pr creation

* Reworks a bit how the previous migrations are handled and updates the instructions accordingly

* Expand the readme with baseline/migrate

---------

Co-authored-by: Werner <Arrow768@users.noreply.github.com>
2023-08-19 22:32:13 +02:00

42 lines
1.9 KiB
SQL

--
-- Adds the cargo logging tables
--
CREATE TABLE `ss13_cargo_orderlog` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`game_id` VARCHAR(50) NOT NULL DEFAULT '' COLLATE 'utf8mb4_unicode_ci',
`order_id` INT(11) NOT NULL,
`status` VARCHAR(50) NOT NULL DEFAULT '' COLLATE 'utf8mb4_unicode_ci',
`price` INT(11) NOT NULL DEFAULT '0',
`ordered_by_id` INT(11) NULL DEFAULT NULL,
`ordered_by` VARCHAR(128) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
`authorized_by_id` INT(11) NULL DEFAULT NULL,
`authorized_by` VARCHAR(128) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
`received_by_id` INT(11) NULL DEFAULT NULL,
`received_by` VARCHAR(128) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
`paid_by_id` INT(11) NULL DEFAULT NULL,
`paid_by` VARCHAR(128) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
`time_submitted` TIME NULL DEFAULT NULL,
`time_approved` TIME NULL DEFAULT NULL,
`time_shipped` TIME NULL DEFAULT NULL,
`time_delivered` TIME NULL DEFAULT NULL,
`time_paid` TIME NULL DEFAULT NULL,
`reason` TEXT(65535) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB;
CREATE TABLE `ss13_cargo_orderlog_items` (
`cargo_orderlog_id` INT(11) UNSIGNED NOT NULL,
`cargo_item_id` INT(11) UNSIGNED NOT NULL,
`amount` INT(11) NOT NULL,
PRIMARY KEY (`cargo_orderlog_id`, `cargo_item_id`) USING BTREE,
INDEX `index_orderlog_id` (`cargo_orderlog_id`) USING BTREE,
INDEX `index_item_id` (`cargo_item_id`) USING BTREE,
CONSTRAINT `FK_ss13_cargo_orderlog_items_ss13_cargo_items` FOREIGN KEY (`cargo_item_id`) REFERENCES `ss13_cargo_items` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT `FK_ss13_cargo_orderlog_items_ss13_cargo_orderlog` FOREIGN KEY (`cargo_orderlog_id`) REFERENCES `ss13_cargo_orderlog` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
)
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB;