CREATE TABLE `WeaponCategories` ( `Id` int NOT NULL AUTO_INCREMENT, `Category` longtext CHARACTER SET utf8mb4 NULL, CONSTRAINT `PK_WeaponCategories` PRIMARY KEY (`Id`) ); CREATE TABLE `Weapons` ( `Id` int NOT NULL AUTO_INCREMENT, `WeaponModel` longtext CHARACTER SET utf8mb4 NULL, `CategoryId` int NOT NULL, `SlotID` int NOT NULL, `Ammo` int NOT NULL, `Price` float NOT NULL, CONSTRAINT `PK_Weapons` PRIMARY KEY (`Id`), CONSTRAINT `FK_Weapons_WeaponCategories_CategoryId` FOREIGN KEY (`CategoryId`) REFERENCES `WeaponCategories` (`Id`) ON DELETE CASCADE ); CREATE TABLE `UserWeapons` ( `Id` int NOT NULL AUTO_INCREMENT, `UserId` int NOT NULL, `WeaponId` int NOT NULL, `Ammo` int NOT NULL, CONSTRAINT `PK_UserWeapons` PRIMARY KEY (`Id`), CONSTRAINT `FK_UserWeapons_Users_UserId` FOREIGN KEY (`UserId`) REFERENCES `Users` (`Id`) ON DELETE CASCADE, CONSTRAINT `FK_UserWeapons_Weapons_WeaponId` FOREIGN KEY (`WeaponId`) REFERENCES `Weapons` (`Id`) ON DELETE CASCADE ); CREATE INDEX `IX_UserWeapons_UserId` ON `UserWeapons` (`UserId`); CREATE INDEX `IX_UserWeapons_WeaponId` ON `UserWeapons` (`WeaponId`); CREATE INDEX `IX_Weapons_CategoryId` ON `Weapons` (`CategoryId`); INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) VALUES ('20210413201146_Ammunations', '3.1.3'); ALTER TABLE `Weapons` ADD `AmmunationActive` tinyint(1) NOT NULL DEFAULT FALSE; ALTER TABLE `Weapons` ADD `Legal` tinyint(1) NOT NULL DEFAULT FALSE; INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) VALUES ('20210416175726_Ammunations2', '3.1.3');