Feature migrations up/down (#270)

* Migrations up down

* Add forum model

* Syntactic sugar for db structure changes

* Refactor migrations with $up & $down

* Fix migrations upgrade and downgrade

+ Add option to disable auto migrate

* Add migrate:to command

Usage: php aac migrate:to x (x - database version)

* Show error when mail is not enabled

* Fixes regarding to init.php

* Add migrate command to manually upgrade db, incase auto migrate is disabled

* Fixed rest of the migrations

* Limit max version of database

* Don't allow minus number

* Option to clear specified plugin settings by name

* Version is required

* Fix PHPStan errors

* Unset $up after migration, to prevent executing same migration twice

* Add database version to output

* This is not needed

* Update 5.php

* Set database_auto_migrate on install

* Set blank & color only if current db version supports it

* Fix duplicate function declaration
This commit is contained in:
Slawomir Boczek
2024-11-22 15:29:23 +01:00
committed by GitHub
parent 79636280a7
commit 3f6ff3a332
72 changed files with 1268 additions and 396 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace MyAAC\Models;
use Illuminate\Database\Eloquent\Model;
class Forum extends Model
{
protected $table = TABLE_PREFIX . 'forum';
public $timestamps = false;
protected $fillable = ['first_post', 'last_post', 'section', 'replies', 'views', 'author_aid', 'author_guid', 'post_text', 'post_topic', 'post_smile', 'post_html', 'post_date', 'last_edit_aid', 'edit_date', 'post_ip', 'sticked', 'closed'];
protected $casts = [
'first_post' => 'integer',
'last_post' => 'integer',
'section' => 'integer',
'replies' => 'integer',
'views' => 'integer',
'author_aid' => 'integer',
'author_guid' => 'integer',
'post_smile' => 'boolean',
'post_html' => 'boolean',
'post_date' => 'integer',
'last_edit_aid' => 'integer',
'edit_date' => 'integer',
'sticked' => 'boolean',
'closed' => 'boolean'
];
}