Separate migration 44 with 45

This commit is contained in:
slawkens 2025-05-14 10:52:06 +02:00
parent 83a6f4b61d
commit ae5be41e11
5 changed files with 38 additions and 21 deletions

View File

@ -27,7 +27,7 @@ if (version_compare(phpversion(), '8.1', '<')) die('PHP version 8.1 or higher is
const MYAAC = true; const MYAAC = true;
const MYAAC_VERSION = '1.4.1-dev'; const MYAAC_VERSION = '1.4.1-dev';
const DATABASE_VERSION = 44; const DATABASE_VERSION = 45;
const TABLE_PREFIX = 'myaac_'; const TABLE_PREFIX = 'myaac_';
define('START_TIME', microtime(true)); define('START_TIME', microtime(true));
define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX')); define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX'));

View File

@ -1,4 +1,4 @@
SET @myaac_database_version = 44; SET @myaac_database_version = 45;
CREATE TABLE `myaac_account_actions` CREATE TABLE `myaac_account_actions`
( (

View File

@ -79,6 +79,10 @@ $up();
require_once SYSTEM . 'migrations/31.php'; require_once SYSTEM . 'migrations/31.php';
$up(); $up();
// rules page
require_once SYSTEM . 'migrations/45.php';
$up();
if(ModelsFAQ::count() == 0) { if(ModelsFAQ::count() == 0) {
ModelsFAQ::create([ ModelsFAQ::create([
'question' => 'What is this?', 'question' => 'What is this?',

View File

@ -11,29 +11,10 @@ use MyAAC\Models\Pages;
$up = function() { $up = function() {
Menu::where('link', 'server-info')->update(['link' => 'ots-info']); Menu::where('link', 'server-info')->update(['link' => 'ots-info']);
Menu::where('link', 'changelog')->update(['link' => 'change-log']); Menu::where('link', 'changelog')->update(['link' => 'change-log']);
Pages::where('name', 'rules_on_the_page')->update(['hide' => 1]);
$rules = Pages::where('name', 'rules')->first();
if (!$rules) {
Pages::create([
'name' => 'rules',
'title' => 'Server Rules',
'body' => '<b>{{ config.lua.serverName }} Rules</b><br/>' . nl2br(file_get_contents(__DIR__ . '/30-rules.txt')),
'date' => time(),
'player_id' => 1,
'php' => 0,
'enable_tinymce' => 0,
'access' => 0,
'hide' => 0,
]);
}
}; };
$down = function() { $down = function() {
Menu::where('link', 'ots-info')->update(['link' => 'server-info']); Menu::where('link', 'ots-info')->update(['link' => 'server-info']);
Menu::where('link', 'change-log')->update(['link' => 'changelog']); Menu::where('link', 'change-log')->update(['link' => 'changelog']);
Pages::where('name', 'rules_on_the_page')->update(['hide' => 0]);
}; };

32
system/migrations/45.php Normal file
View File

@ -0,0 +1,32 @@
<?php
// 2025-05-14
// update pages links
// server-info conflicts with apache2 mod
// Changelog conflicts with changelog files
use MyAAC\Models\Pages;
$up = function() {
Pages::where('name', 'rules_on_the_page')->update(['hide' => 1]);
$rules = Pages::where('name', 'rules')->first();
if (!$rules) {
Pages::create([
'name' => 'rules',
'title' => 'Server Rules',
'body' => '<b>{{ config.lua.serverName }} Rules</b><br/>' . nl2br(file_get_contents(__DIR__ . '/30-rules.txt')),
'date' => time(),
'player_id' => 1,
'php' => 0,
'enable_tinymce' => 0,
'access' => 0,
'hide' => 0,
]);
}
};
$down = function() {
Pages::where('name', 'rules_on_the_page')->update(['hide' => 0]);
};