<?php

$DB_MIGRATION = array('description' => function () {
    return 'ranged weapon building';
}, 'up' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `blueprints`
				ADD COLUMN `bonusRangedFightValue` INT NOT NULL AFTER `upgradeWeaponModificator`,
				ADD COLUMN `reducePhysicalStrengthRequirement` INT NOT NULL AFTER `bonusRangedFightValue`
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "bonusRangedFightValue", "Erleichterung der FK-Probe", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "reducePhysicalStrengthRequirement", "Verringerte KK-Voraussetzung", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `blueprints`
				DROP COLUMN `bonusRangedFightValue`,
				DROP COLUMN `reducePhysicalStrengthRequirement`
		');
    $results[] = query_raw('
			DELETE FROM `translations` WHERE `key` IN ("bonusRangedFightValue", "reducePhysicalStrengthRequirement")
		');
    return !in_array(false, $results);
});
			UPDATE `translations` SET `key`="weaponModificatorHelp" WHERE  `key`="forceModificatorHelp"
		');
    $results[] = query_raw('
			UPDATE `translations` SET `key`="baseWeaponModificator", `value`="Grund-Waffenmodifikator" WHERE  `key`="baseForceModificator"
		');
    $results[] = query_raw('
			UPDATE `translations` SET `key`="upgradeWeaponModificator", `value`="Zusätzlicher Waffenmodifikator" WHERE  `key`="upgradeForceModificator"
		');
    $results[] = query_raw('
			UPDATE `translations` SET `key`="wm" WHERE  `key`="fm"
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			UPDATE `translations` SET `key`="forceModificator", `value`="Wuchtmodifikator" WHERE `key`="weaponModificator"
		');
    $results[] = query_raw('
			UPDATE `translations` SET `key`="forceModificatorHelp" WHERE  `key`="weaponModificatorHelp"
		');
    $results[] = query_raw('
			UPDATE `translations` SET `key`="baseForceModificator", `value`="Grund-Wuchtmodifikator" WHERE  `key`="baseWeaponModificator"
		');
    $results[] = query_raw('
			UPDATE `translations` SET `key`="upgradeForceModificator", `value`="Zusätzlicher Wuchtmodifikator" WHERE  `key`="upgradeWeaponModificator"
		');
    $results[] = query_raw('
			UPDATE `translations` SET `key`="fm" WHERE  `key`="wm"
		');
    return !in_array(false, $results);
});
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "productionTime", "Produktionszeit", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "day", "Tag", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `materialsToBlueprints`
				DROP COLUMN `talent`
		');
    $results[] = query_raw('
			ALTER TABLE `craftings`
				ADD COLUMN `gainedTalentPoints` TINYINT(4) NOT NULL AFTER `planProofModificator`,
				DROP COLUMN `doneProofs`
		');
    $results[] = query_raw('
			UPDATE craftings
			JOIN (SELECT craftingTalentPoints.craftingId, SUM(craftingTalentPoints.gainedTalentPoints) AS sumGainedTalentPoints FROM craftingTalentPoints GROUP BY craftingTalentPoints.craftingId) AS ctp ON ctp.craftingId = craftings.craftingId
			SET craftings.gainedTalentPoints = ctp.sumGainedTalentPoints
		');
    $results[] = query_raw('
			DROP TABLE `craftingTalentPoints`
		');
    $results[] = query_raw('
			DELETE FROM `translations` WHERE `key` IN ("talent", "noTalentPointsToAdd", "productionTime", "day")
		');
    return !in_array(false, $results);
});
<?php

$DB_MIGRATION = array('description' => function () {
    return 'ranged weapon blueprint showing';
}, 'up' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "bonusRangedFightValueNote", "FK", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "reducePhysicalStrengthRequirementNote", "KK", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "improvisationalNote", "i", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "twoHandedNote", "z", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "privilegedNote", "p", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			DELETE FROM `translations` WHERE `key` IN ("bonusRangedFightValueNote", "reducePhysicalStrengthRequirementNote", "improvisationalNote", "twoHandedNote", "privilegedNote")
		');
    return !in_array(false, $results);
});
    $results[] = query_raw('
			ALTER TABLE `materials`
				CHANGE COLUMN `name` `name` VARCHAR(255) NOT NULL COLLATE "utf8_bin" AFTER `materialId`,
				CHANGE COLUMN `additional` `additional` TEXT NOT NULL COLLATE "utf8_bin" AFTER `materialTypeId`
		');
    $results[] = query_raw('
			ALTER TABLE `materialTypes`
				ALTER `name` DROP DEFAULT
		');
    $results[] = query_raw('
			ALTER TABLE `materialTypes`
				CHANGE COLUMN `name` `name` VARCHAR(255) NOT NULL COLLATE "utf8_bin" AFTER `materialTypeId`
		');
    $results[] = query_raw('
			ALTER TABLE `techniques`
				ALTER `name` DROP DEFAULT
		');
    $results[] = query_raw('
			ALTER TABLE `techniques`
				CHANGE COLUMN `name` `name` VARCHAR(255) NOT NULL COLLATE "utf8_bin" AFTER `techniqueId`
		');
    $results[] = query_raw('
			ALTER TABLE `users`
				ALTER `email` DROP DEFAULT
		');
    $results[] = query_raw('
			ALTER TABLE `users`
				CHANGE COLUMN `email` `email` VARCHAR(255) NOT NULL COLLATE "utf8_bin" AFTER `password`
		');
    return !in_array(false, $results);
});
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "usernameAlreadyInUse", "Der Benutzername wird bereits verwendet.", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "usernameAlreadyInUse", "The username is already in use.", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "registrationSuccessful", "Die Registrierung war erfolgreich.<br />Du erhältst eine E-Mail sobald du freigeschalten wurdest.", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "registrationSuccessful", "The registration was successful.<br />You will receive an email on activation.", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "admin", "Admin", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "admin", "Admin", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $result = array();
    $result[] = query_raw('
			DROP TABLE users
		');
    $result[] = query_raw('
			DROP TABLE translations
		');
    $result[] = query_raw('
			DROP TABLE languages
		');
    return !!$result;
});
 * @package sql
 * @author  friend8 <*****@*****.**>
 * @license https://www.gnu.org/licenses/lgpl.html LGPLv3
 */
$DB_MIGRATION = array('description' => function () {
    return 'Rename the weapon modificator fields';
}, 'up' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `blueprints`
				CHANGE COLUMN `materialForceModificator` `materialWeaponModificator` TEXT NOT NULL COLLATE "utf8_general_ci" AFTER `itemTypeId`,
				CHANGE COLUMN `upgradeForceModificator` `upgradeWeaponModificator` TEXT NOT NULL COLLATE "utf8_general_ci" AFTER `upgradeInitiative`
		');
    $results[] = query_raw('
			ALTER TABLE `materialAssets`
				CHANGE COLUMN `forceModificator` `weaponModificator` TEXT NOT NULL COLLATE "utf8_general_ci" AFTER `armor`
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `blueprints`
				CHANGE COLUMN `materialWeaponModificator` `materialForceModificator` TEXT NOT NULL COLLATE "utf8_general_ci" AFTER `itemTypeId`,
				CHANGE COLUMN `upgradeWeaponModificator` `upgradeForceModificator` TEXT NOT NULL COLLATE "utf8_general_ci" AFTER `upgradeInitiative`
		');
    $results[] = query_raw('
			ALTER TABLE `materialAssets`
				CHANGE COLUMN `weaponModificator` `forceModificator` TEXT NOT NULL COLLATE "utf8_general_ci" AFTER `armor`
		');
    return !in_array(false, $results);
});
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "woodworking", "Holzbearbeitung", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "leatherworking", "Lederverarbeitung", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "tailoring", "Schneiderei", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "dateFormat", "d.m.Y", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "addCharacter", "Charakter hinzufügen", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "characterList", "Charakterliste", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "characters", "Charaktere", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "upload", "Hochladen", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			DROP TABLE `characters`
		');
    return !in_array(false, $results);
});
			ALTER TABLE `blueprints`
				ADD COLUMN `damageType` ENUM("damage","stamina") NOT NULL DEFAULT "damage" COLLATE "utf8_general_ci" AFTER `itemTypeId`
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "(S)", "(A)", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "damageType", "Schadenstyp", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "damage", "Schaden", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "stamina", "Ausdauer", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `items`
				DROP COLUMN `damageType`
		');
    $results[] = query_raw('
			ALTER TABLE `blueprints`
				DROP COLUMN `damageType`
		');
    $results[] = query_raw('
			DELETE FROM `translations` WHERE `key` IN ("(S)", "damageType", "damage", "stamina")
		');
    return !in_array(false, $results);
});
 *
 * @package sql
 * @author  friend8 <*****@*****.**>
 * @license https://www.gnu.org/licenses/lgpl.html LGPLv3
 */
$DB_MIGRATION = array('description' => function () {
    return 'Account blueprints';
}, 'up' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `blueprints`
				ADD COLUMN `userid` INT(10) UNSIGNED NOT NULL AFTER `blueprintId`
		');
    $results[] = query_raw('
			UPDATE blueprints SET userId = 1
		');
    $results[] = query_raw('
			ALTER TABLE `blueprints`
				ADD CONSTRAINT `blueprints_user` FOREIGN KEY (`userId`) REFERENCES `users` (`userId`) ON UPDATE CASCADE ON DELETE CASCADE
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `blueprints`
				DROP COLUMN `userid`,
				DROP INDEX `blueprints_user`,
				DROP FOREIGN KEY `blueprints_user`
		');
    return !in_array(false, $results);
});
			DROP COLUMN `unsellable`
		');
    $results[] = query_raw('
			ALTER TABLE `techniques`
				ADD COLUMN `forceModificator` TEXT NOT NULL AFTER `hitPoints`
		');
    $results[] = query_raw('
			ALTER TABLE `materials`
			DROP COLUMN `forceModificator`
		');
    $results[] = query_raw('
			ALTER TABLE `materials`
			DROP COLUMN `timeFactor`
		');
    $results[] = query_raw('
			ALTER TABLE `materials`
			DROP COLUMN `hitPoints`
		');
    $results[] = query_raw('
			ALTER TABLE `itemtypes`
			ALTER `talentPoints` DROP DEFAULT
		');
    $results[] = query_raw('
			ALTER TABLE `itemtypes`
				CHANGE COLUMN `talentPoints` `priceFactor` DECIMAL(4,2) NOT NULL AFTER `name`
		');
    $results[] = query_raw('
			UPDATE `translations` SET `value`="Werte in folgendem Schema eintragen: TA / PA\\r\\nWenn zwischen mehreren Modifikatoren gewählt werden soll, können die Wertpaare mit \\"||\\", \\"or\\" oder \\"oder\\" getrennt werden." WHERE  `translationId`=73
		');
    return !in_array(false, $results);
});
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			DELETE FROM `translations`
			WHERE `key` = "email"
				OR `key` = "lostPassword"
				OR `key` = "retrievePassword"
				OR `key` = "emailAlreadyInUse"
				OR `key` = "lostPasswordSubject"
				OR `key` = "lostPasswordMessage"
				OR `key` = "emptyEmail"
				OR `key` = "lostPasswordNoUserFound"
				OR `key` = "lostPasswordMailSent"
		');
    $results[] = query_raw('
			ALTER TABLE `users`
				ADD COLUMN `salt` VARCHAR(255) NOT NULL COLLATE "utf8_bin" AFTER `password`
		');
    $sql = '
			SELECT
				`userId`,
				`password`
			FROM users
		';
    $users = query($sql, true);
    foreach ($users as $user) {
        $passwordParts = explode('$', $user['password']);
        $sql = '
				UPDATE users
				SET password = '******'3']) . ',
					salt = ' . sqlval($passwordParts['2']) . '
				WHERE `userId` = ' . sqlval($user['userId']) . '
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "status", "Status", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`) VALUES (1, "activate", "aktivieren")
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "activate", "activate", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`) VALUES (1, "removeAdmin", "entfernen")
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "removeAdmin", "remove", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`) VALUES (1, "setAdmin", "setzen")
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "setAdmin", "set", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`) VALUES (1, "active", "aktiv")
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "active", "active", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    return true;
});
    $results[] = query_raw('
			CREATE TABLE `itemTypes` (
				`itemTypeId` INT UNSIGNED NOT NULL AUTO_INCREMENT,
				`name` VARCHAR(255) NOT NULL,
				`priceFactor` DECIMAL(4,2) NOT NULL,
				`time` DECIMAL(4,2) NOT NULL,
				`deleted` TINYINT(1) UNSIGNED NOT NULL DEFAULT "0",
				PRIMARY KEY (`itemTypeId`)
			)
			COLLATE="utf8_bin"
			ENGINE=InnoDB
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "itemType", "Gegenstandstyp", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "time", "Zeiteinheiten", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "addItemType", "Gegenstandstyp hinzufügen", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "noItemTypesFound", "Keine Gegenstandstypen gefunden", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $result = query_raw('
			DROP TABLE itemTypes
		');
    return !!$result;
});
/**
 * SQL statements for the no other technique allowed translations.
 *
 * @package sql
 * @author  friend8 <*****@*****.**>
 * @license https://www.gnu.org/licenses/lgpl.html LGPLv3
 */
$DB_MIGRATION = array('description' => function () {
    return 'Check for no other allowed flag on techniques';
}, 'up' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "noOtherAllowedInfo", "<p>Es können keine anderen Techniken mit der ausgewählten Technik kombiniert werden.</p>\\r\\n<p>Sollen alle anderen Techniken aus der Liste entfernt werden?</p>", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "ok", "Ok", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "cancel", "Abbrechen", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			DELETE FROM translations
			WHERE `key` = "noOtherAllowedInfo"
				OR `key` = "ok"
				OR `key` = "cancel"
		');
    return !in_array(false, $results);
});
<?php

$DB_MIGRATION = array('description' => function () {
    return 'ranged weapon items';
}, 'up' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `items`
				ADD COLUMN `physicalStrengthRequirement` INT NOT NULL DEFAULT "0" AFTER `weight`
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "physicalStrengthRequirement", "Körperkraftvoraussetzung", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `items`
				DROP COLUMN `physicalStrengthRequirement`
		');
    $results[] = query_raw('
			DELETE FROM `translations`
			WHERE `key` IN("physicalStrengthRequirement")
		');
    return !in_array(false, $results);
});
			ALTER TABLE `blueprints`
				DROP COLUMN `toolsProofModificator`,
				DROP COLUMN `planProofModificator`
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "easing", "Erleichterung", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `blueprints`
				ADD COLUMN `toolsProofModificator` INT NOT NULL AFTER `weight`,
				ADD COLUMN `planProofModificator` INT NOT NULL AFTER `toolsProofModificator`
		');
    $results[] = query_raw('
			UPDATE craftings, blueprints
			SET blueprints.toolsProofModificator = craftings.toolsProofModificator,
				blueprints.planProofModificator = craftings.planProofModificator
			WHERE blueprints.blueprintId = craftings.blueprintId
		');
    $results[] = query_raw('
			ALTER TABLE `craftings`
				DROP COLUMN `toolsProofModificator`,
				DROP COLUMN `planProofModificator`
		');
    $results[] = query_raw('
			DELETE FROM `translations` WHERE `key` = "easing"
		');
    return !in_array(false, $results);
});
<?php

/**
 * SQL statements for the translations of the select material weapon modificator.
 *
 * @package sql
 * @author  friend8 <*****@*****.**>
 * @license https://www.gnu.org/licenses/lgpl.html LGPLv3
 */
$DB_MIGRATION = array('description' => function () {
    return 'Material weapon modificator';
}, 'up' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "chooseWeaponModificator", "Waffenmodifikator auswählen", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "atPa", "AT/PA", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			DELETE FROM `translations`
			WHERE `key` IN ("chooseWeaponModificator", "atPa")
		');
    return !in_array(false, $results);
});
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "change", "Change", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "emptyGeneralOptions", "Bitte fülle alle Felder aus.", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "emptyGeneralOptions", "Please fill in all fields.", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`) VALUES (1, "emptyPasswordOptions", "Bitte fülle alle Felder aus.")
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "emptyPasswordOptions", "Please fill in all fields.", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`) VALUES (1, "generalSuccess", "Daten geändert.")
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "generalSuccess", "Data changed.", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`) VALUES (1, "passwordSuccess", "Passwort geändert.")
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (2, "passwordSuccess", "Password changed.", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    return true;
});
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "meleeWeapon", "Nahkampfwaffe", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "rangedWeapon", "Fernkampfwaffe", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "shield", "Schild", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "projectile", "Projektil", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "type", "Typ", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			ALTER TABLE `items`
				DROP COLUMN `itemType`
		');
    $results[] = query_raw('
			ALTER TABLE `itemTypes`
				CHANGE COLUMN `type` `type` ENUM("weapon","shield","armor","projectile") NOT NULL DEFAULT "weapon" COLLATE "utf8_general_ci" AFTER `name`
		');
    $results[] = query_raw('
			DELETE FROM `translations`
			WHERE `key` IN ("meleeWeapon", "rangedWeapon", "shield", "projectile", "type")
		');
    return !in_array(false, $results);
});
    $results[] = query('
			UPDATE `dsa_blacksmith`.`translations` SET `value`="Werte in folgendem Schema eintragen: TA / PA\\r\\nWenn zwischen mehreren Modifikatoren gewählt werden soll, können die Wertpaare mit "||", "or" oder "oder" getrennt werden.\\r\\nFür eine Aktivierung der Modifikatoren ab bestimmten Prozentsätzen, kann der jeweilige Prozentsatz als erster Wert in der Zeile eingetragen und mit "|" von den Modifikatoren getrennt werden." WHERE  `translationId`=73
		');
    $results[] = query_raw('
			ALTER TABLE `materials`
				ADD COLUMN `timeFactor` DECIMAL(4,2) NOT NULL AFTER `materialTypeId`,
				ADD COLUMN `priceFactor` DECIMAL(4,2) NOT NULL AFTER `timeFactor`,
				ADD COLUMN `priceWeight` INT UNSIGNED NOT NULL AFTER `priceFactor`,
				ADD COLUMN `proof` INT NOT NULL AFTER `priceWeight`,
				ADD COLUMN `breakFactor` INT NOT NULL AFTER `proof`,
				ADD COLUMN `hitPoints` INT UNSIGNED NOT NULL AFTER `breakFactor`,
				ADD COLUMN `armor` INT UNSIGNED NOT NULL AFTER `hitPoints`,
				ADD COLUMN `forceModificator` TEXT NOT NULL AFTER `armor`
		');
    $results[] = query_raw('
			UPDATE materials AS m
			LEFT JOIN materialAssets AS ma ON (ma.`materialId` = m.`materialId`)
			SET m.timeFactor = ma.`timeFactor`,
				m.priceFactor = ma.`priceFactor`,
				m.priceWeight = ma.`priceWeight`,
				m.proof = ma.proof,
				m.breakFactor = ma.`breakFactor`,
				m.hitPoints = ma.`hitPoints`,
				m.armor = ma.armor,
				m.forceModificator = ma.`forceModificator`
		');
    $results[] = query_raw('
			DROP TABLE materialAssets
		');
    return !in_array(false, $results);
});
<?php

/**
 * SQL statements for the first information shown on the index page.
 *
 * @package sql
 * @author  friend8 <*****@*****.**>
 * @license https://www.gnu.org/licenses/lgpl.html LGPLv3
 */
$DB_MIGRATION = array('description' => function () {
    return 'Running craftings on the index page';
}, 'up' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "runningCraftings", "Laufende Herstellungen", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "noCraftingRunning", "Aktuell sind keine Herstellungen am laufen.", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			DELETE FROM `translations`
			WHERE `key` = "runningCraftings"
				OR `key` = "noCraftingRunning"
		');
    return !in_array(false, $results);
});
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "technique", "Technik", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "timeFactor", "Zeit (Faktor)", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "hitPoints", "Trefferpunkte", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "forceModificator", "Wuchtmodifikator", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "addTechnique", "Technik hinzufügen", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "noTechniquesFound", "Keine Techniken gefunden", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "forceModificatorHelp", "Werte in folgendem Schema eintragen: TA / PA\\r\\nWenn zwischen mehreren Modifikatoren gewählt werden soll, können die Wertpaare mit \\"||\\", \\"or\\" oder \\"oder\\" getrennt werden.", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "or", "oder", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $result = query_raw('
			DROP TABLE techniques
		');
    return !!$result;
});
<?php

$DB_MIGRATION = array('description' => function () {
    return 'Edit entries';
}, 'up' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "editItemType", "Gegenstandstyp bearbeiten", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "unkownError", "Ein unbekannter Fehler ist aufgetreten.", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "editItem", "Gegenstand bearbeiten", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "editTechnique", "Technik bearbeiten", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
            DELETE FROM translations WHERE `key` IN ("editItemType", "unkownError", "editItem", "editTechnique")
		');
    return !in_array(false, $results);
});
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "days", "Tage", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "estimatedFinishingTime", "geschätzte Produktionszeit", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "showBlueprint", "Bauplan anzeigen", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "addTalentPoints", "Talentpunkte hinzufügen", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "add", "Hinzufügen", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			DROP TABLE `craftings`
		');
    $results[] = query_raw('
			ALTER TABLE `itemtypes`
				DROP COLUMN `type`
		');
    $results[] = query_raw('
			ALTER TABLE `materialstoblueprints`
				DROP COLUMN `materialAssetId`,
				DROP FOREIGN KEY `materialsToBlueprints_materialAssetId`
		');
    return !in_array(false, $results);
});
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "proof", "Probe", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "breakFactor", "Bruchfaktor", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "armor", "Rüstung", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "additional", "zusätzliche Modifikatoren", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "noMaterialsFound", "Es wurden keine Materialien gefunden.", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "addMaterial", "Material hinzufügen", 0)
		');
    $results[] = query_raw('
			INSERT INTO `translations` (`languageId`, `key`, `value`, `deleted`) VALUES (1, "addMaterialType", "Materialart hinzufügen", 0)
		');
    return !in_array(false, $results);
}, 'down' => function ($migration_metadata) {
    $results = array();
    $results[] = query_raw('
			DROP TABLE materials
		');
    $results[] = query_raw('
			DROP TABLE materialTypes
		');
    return !in_array(false, $results);
});
			SET blueprints.basePrice = items.price,
				blueprints.twoHanded = items.twoHanded,
				blueprints.improvisational = items.improvisational,
				blueprints.baseHitPointsDice = items.hitPointsDice,
				blueprints.baseHitPointsDiceType = items.hitPointsDiceType,
				blueprints.baseHitPoints = items.hitPoints,
				blueprints.baseBreakFactor = items.breakFactor,
				blueprints.baseInitiative = items.initiative,
				blueprints.baseForceModificator = items.weaponModificator,
				blueprints.weight = items.weight
			WHERE blueprints.itemId = items.itemId
		');
    $results[] = query_raw('
			ALTER TABLE `blueprints`
				DROP COLUMN `itemId`,
				DROP FOREIGN KEY `blueprints_item`
		');
    $results[] = query_raw('
			DROP TABLE `items`
		');
    $results[] = query_raw('
			DELETE FROM translations
			WHERE `key` = "item"
				OR `key` = "items"
				OR `key` = "addItem"
				OR `key` = "noItemsFound"
				OR `key` = "initiative"
				OR `key` = "privileged"
		');
    return !in_array(false, $results);
});