Database import tables on every install with "IF NOT EXISTS"

This fixed errors when one table is missing or is duplicated
This commit is contained in:
slawkens
2025-10-25 22:11:33 +02:00
parent 44110a9496
commit bde158e3d7
7 changed files with 145 additions and 55 deletions

View File

@@ -18,7 +18,16 @@ class Changelog extends Model {
public $timestamps = false;
protected $fillable = [
'body', 'type', 'where',
'date', 'player_id', 'hide',
];
public function scopeIsPublic($query) {
$query->where('hide', '!=', 1);
}
public function player() {
return $this->belongsTo(Player::class);
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace MyAAC\Models;
use Illuminate\Database\Eloquent\Model;
class ForumBoard extends Model {
protected $table = TABLE_PREFIX . 'forum_boards';
public $timestamps = false;
protected $fillable = [
'name', 'description', 'ordering',
'guild', 'access', 'closed', 'hide',
];
}

View File

@@ -10,4 +10,9 @@ class Gallery extends Model {
public $timestamps = false;
protected $fillable = [
'comment', 'image', 'thumb',
'author', 'ordering', 'hide',
];
}

View File

@@ -0,0 +1,15 @@
<?php
namespace MyAAC\Models;
use Illuminate\Database\Eloquent\Model;
class NewsCategory extends Model {
protected $table = TABLE_PREFIX . 'news_categories';
public $timestamps = false;
protected $fillable = [
'name', 'description', 'icon_id', 'hide'
];
}