auto-update
This commit is contained in:
@@ -11,7 +11,7 @@ return new class() extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('date_time_format', function (Blueprint $table) {
|
||||
\Illuminate\Support\Facades\Schema::create('date_time_format', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('format');
|
||||
});
|
||||
|
@@ -10,12 +10,8 @@ return new class() extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$current_version1 = \Config::get('app.version');
|
||||
$current_version2 = explode(' ', $current_version1);
|
||||
$current_version = $current_version2[1];
|
||||
$settings_system = DB::table('settings_system')->where('id', '=', '1')->first();
|
||||
if ($settings_system != null) {
|
||||
DB::table('settings_system')->insert(['version' => $current_version]);
|
||||
DB::table('common_settings')
|
||||
->insert(
|
||||
['option_name' => 'enable_rtl', 'option_value' => ''],
|
||||
|
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterColumnTypeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->modifyStringType(Schema::getAllTables());
|
||||
}
|
||||
|
||||
private function modifyStringType($tables)
|
||||
{
|
||||
foreach ($tables as $table) {
|
||||
$tableName = (array)$table;
|
||||
$tableName = reset($tableName);
|
||||
|
||||
$columns = Schema::getColumnListing($tableName);
|
||||
|
||||
foreach ($columns as $column) {
|
||||
if (Schema::getColumnType($tableName, $column) == 'string') {
|
||||
Schema::table($tableName, function ($table) use($column) {
|
||||
$table->string($column)->nullable()->change();
|
||||
});
|
||||
} elseif (Schema::getColumnType($tableName, $column) == 'boolean') {
|
||||
Schema::table($tableName, function ($table) use($column) {
|
||||
$table->boolean($column)->default(0)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
namespace Database\Seeders\v_2_0_0;
|
||||
|
||||
use App\Model\Common\Template;
|
||||
use App\Model\Common\TemplateSet;
|
||||
@@ -37,6 +37,7 @@ use App\Model\helpdesk\Workflow\WorkflowClose;
|
||||
use App\Model\kb\Settings;
|
||||
// Knowledge base
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
@@ -47,8 +48,26 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$tables = Schema::getAllTables();
|
||||
|
||||
(new AlterColumnTypeSeeder())->run();
|
||||
foreach ($tables as $table) {
|
||||
$tableName = (array)$table;
|
||||
$tableName = reset($tableName);
|
||||
|
||||
$columns = Schema::getColumnListing($tableName);
|
||||
|
||||
foreach ($columns as $column) {
|
||||
if (Schema::getColumnType($tableName, $column) == 'string') {
|
||||
Schema::table($tableName, function ($table) use($column) {
|
||||
$table->string($column)->nullable()->change();
|
||||
});
|
||||
} elseif (Schema::getColumnType($tableName, $column) == 'boolean') {
|
||||
Schema::table($tableName, function ($table) use($column) {
|
||||
$table->boolean($column)->default(0)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Date time format */
|
||||
$date_time_formats = [
|
||||
'd/m/Y H:i:s',
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
namespace Database\Seeders\v_2_0_0;
|
||||
|
||||
use App\Model\MailJob\MailService;
|
||||
use App\Model\MailJob\QueueService;
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
namespace Database\Seeders\v_2_0_0;
|
||||
|
||||
use App\Model\helpdesk\Ticket\Ticket_source;
|
||||
use Illuminate\Database\Seeder;
|
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
namespace Database\Seeders\v_2_0_0;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Database\Seeder;
|
Reference in New Issue
Block a user