mirror of
https://github.com/slawkens/myaac.git
synced 2025-07-01 17:20:15 +02:00
Fixed rest of the migrations
This commit is contained in:
parent
dead8e4043
commit
92de3950a1
@ -38,7 +38,7 @@ $up = function () use ($db) {
|
||||
$v = (int)$v;
|
||||
}
|
||||
|
||||
Spell::where('id', $spell->id)->update('vocations', json_encode($tmp));
|
||||
Spell::where('id', $spell->id)->update(['vocations' => json_encode($tmp)]);
|
||||
}
|
||||
};
|
||||
|
||||
@ -49,8 +49,8 @@ $down = function () use ($db) {
|
||||
}
|
||||
|
||||
// change unique index from spell to name
|
||||
$db->query("ALTER TABLE `" . TABLE_PREFIX . "spells` ADD INDEX `spell`;");
|
||||
$db->query("ALTER TABLE `" . TABLE_PREFIX . "spells` DROP UNIQUE INDEX (`name`);");
|
||||
$db->query("ALTER TABLE `" . TABLE_PREFIX . "spells` DROP INDEX `name`;");
|
||||
$db->query("ALTER TABLE `" . TABLE_PREFIX . "spells` ADD INDEX (`spell`);");
|
||||
|
||||
$db->dropTable(TABLE_PREFIX . 'items');
|
||||
$db->dropTable(TABLE_PREFIX . 'weapons');
|
||||
@ -60,6 +60,6 @@ $down = function () use ($db) {
|
||||
foreach ($spells as $spell) {
|
||||
$vocations = empty($spell->vocations) ? [] : json_decode($spell->vocations);
|
||||
|
||||
Spell::where('id', $spell->id)->update('vocations', implode(',', $vocations));
|
||||
Spell::where('id', $spell->id)->update(['vocations' => implode(',', $vocations)]);
|
||||
}
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// add new forum.guild and forum.access fields
|
||||
|
||||
$up = function ($db) {
|
||||
$up = function () use ($db) {
|
||||
if (!$db->hasColumn(TABLE_PREFIX . 'forum_boards', 'guild')) {
|
||||
$db->addColumn(TABLE_PREFIX . 'forum_boards', 'guild', 'TINYINT(1) NOT NULL DEFAULT 0 AFTER `closed`');
|
||||
}
|
||||
@ -15,7 +15,7 @@ $up = function ($db) {
|
||||
}
|
||||
};
|
||||
|
||||
$down = function ($db) {
|
||||
$down = function () use ($db) {
|
||||
if ($db->hasColumn(TABLE_PREFIX . 'forum_boards', 'guild')) {
|
||||
$db->dropColumn(TABLE_PREFIX . 'forum_boards', 'guild');
|
||||
}
|
||||
|
@ -1,12 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var OTS_DB_MySQL $db
|
||||
*/
|
||||
|
||||
use MyAAC\Models\Pages;
|
||||
|
||||
$up = function () {
|
||||
$up = function () use ($db) {
|
||||
$downloadsModel = Pages::where('name', 'downloads')->first();
|
||||
if (!$downloadsModel) {
|
||||
Pages::create([
|
||||
$db->insert(TABLE_PREFIX . 'pages', [
|
||||
'name' => 'downloads',
|
||||
'title' => 'Downloads',
|
||||
'body' => file_get_contents(__DIR__ . '/27-downloads.html'),
|
||||
@ -14,13 +16,13 @@ $up = function () {
|
||||
'player_id' => 1,
|
||||
'php' => 0,
|
||||
'access' => 0,
|
||||
'hide' => 0,
|
||||
'hidden' => 0,
|
||||
]);
|
||||
}
|
||||
|
||||
$commandsModel = Pages::where('name', 'commands')->first();
|
||||
if (!$commandsModel) {
|
||||
Pages::create([
|
||||
$db->insert(TABLE_PREFIX . 'pages', [
|
||||
'name' => 'commands',
|
||||
'title' => 'Commands',
|
||||
'body' => file_get_contents(__DIR__ . '/27-commands.html'),
|
||||
@ -28,7 +30,7 @@ $up = function () {
|
||||
'player_id' => 1,
|
||||
'php' => 0,
|
||||
'access' => 0,
|
||||
'hide' => 0,
|
||||
'hidden' => 0,
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
@ -6,7 +6,7 @@ $up = function () {
|
||||
$rulesOnPage = Pages::where('name', 'rules_on_the_page')->first();
|
||||
if (!$rulesOnPage) {
|
||||
Pages::create([
|
||||
'name' => 'downloads',
|
||||
'name' => 'rules_on_the_page',
|
||||
'title' => 'Rules',
|
||||
'body' => file_get_contents(__DIR__ . '/30-rules.txt'),
|
||||
'date' => time(),
|
||||
@ -14,7 +14,7 @@ $up = function () {
|
||||
'php' => 0,
|
||||
'enable_tinymce' => 0,
|
||||
'access' => 0,
|
||||
'hide' => 0,
|
||||
'hidden' => 0,
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
@ -3,13 +3,13 @@
|
||||
* @var OTS_DB_MySQL $db
|
||||
*/
|
||||
|
||||
$up = function ($db) {
|
||||
$up = function () use ($db) {
|
||||
if ($db->hasColumn(TABLE_PREFIX . 'screenshots', 'name')) {
|
||||
$db->dropColumn(TABLE_PREFIX . 'screenshots', 'name');
|
||||
}
|
||||
};
|
||||
|
||||
$up = function ($db) {
|
||||
$up = function () use ($db) {
|
||||
if (!$db->hasColumn(TABLE_PREFIX . 'screenshots', 'name')) {
|
||||
$db->addColumn(TABLE_PREFIX . 'screenshots', 'name', 'VARCHAR(30) NOT NULL');
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @var OTS_DB_MySQL $db
|
||||
*/
|
||||
|
||||
$up = function ($db) {
|
||||
$up = function () use ($db) {
|
||||
if ($db->hasTable(TABLE_PREFIX . 'forum_sections')) {
|
||||
$db->renameTable(TABLE_PREFIX . 'forum_sections', TABLE_PREFIX . 'forum_boards');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user