fix database

BE.fix-database
fateme 4 years ago
parent db2bbc92fa
commit f999b87777

@ -3,6 +3,7 @@
namespace App\Providers;
use App\Services\MorphModelFinder;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@ -15,6 +16,7 @@ class AppServiceProvider extends ServiceProvider
public function boot()
{
app(MorphModelFinder::class)->map();
Schema::defaultStringLength(191);
}
/**

@ -1,34 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class TempBussinessAddIsVirtualColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('businesses', function (Blueprint $table) {
$table->enum('is_virtual', ['yes', 'no'])->default('yes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (Schema::hasColumn('businesses', 'is_virtual')) {
Schema::table('businesses', function (Blueprint $table) {
$table->dropColumn('is_virtual');
});
}
}
}

@ -1,34 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class TempAppendRoleNameEnColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tbl_roles', function (Blueprint $table) {
$table->string('name_en');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (Schema::hasColumn('tbl_roles', 'name_en')) {
Schema::table('tbl_roles', function (Blueprint $table) {
$table->dropColumn('name_en');
});
}
}
}

@ -1,36 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class TempAppendPermissionNameEnModuleIdColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tbl_permissions', function (Blueprint $table) {
$table->string('name_en');
$table->unsignedInteger('module_id')->nullable();
$table->index('module_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (Schema::hasColumn('tbl_permissions', 'name_en')) {
Schema::table('tbl_roles', function (Blueprint $table) {
$table->dropColumn('name_en');
});
}
}
}

@ -1,37 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class TempModuleBusinessColumnExpiresAt extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$dbName = config('core.db_name');
Schema::table($dbName . '.module_business', function (Blueprint $table) {
$table->timestamp('expires_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$dbName = config('core.db_name');
if (Schema::hasColumn($dbName . '.module_business', 'expires_at')) {
Schema::table($dbName . '.module_business', function (Blueprint $table) {
$table->dropColumn('expires_at');
});
}
}
}

@ -1,31 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddLoadInHomeColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$dbName = config('core.db_name');
Schema::table($dbName . '.modules', function (Blueprint $table) {
$table->enum('load_in_home', ['yes', 'no'])->default('yes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

@ -1,50 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class TempUpdateColumns extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$dbName = config('crm.db_name');
Schema::table("$dbName.clients", function (Blueprint $table) {
$table->string('father_name', 255)->nullable();
$table->string('telegram', 255)->nullable();
$table->string('website', 255)->nullable();
$table->text('description')->nullable();
$table->unsignedInteger('client_title_id')->nullable();
$table->foreign('client_title_id')->references('id')->on('client_titles');
$table->dropColumn('client_category_id');
});
Schema::table("$dbName.client_statuses", function (Blueprint $table) {
$table->string('color', 255)->nullable();
$table->string('icon', 255)->nullable();
});
$dbName = config('common.db_name');
Schema::table("$dbName.task_statuses", function (Blueprint $table) {
$table->string('color', 255)->nullable();
$table->string('icon', 255)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddFirstNameLastNameColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table("users", function (Blueprint $table) {
$table->string('first_name', 255)->nullable()->after('name');
$table->string('last_name', 255)->nullable()->after('first_name');
});
$dbName = config("crm.db_name");
Schema::table($dbName . ".clients", function (Blueprint $table) {
$table->string('first_name', 255)->nullable()->after('name');
$table->string('last_name', 255)->nullable()->after('first_name');
$table->string('file_code', 255)->nullable()->after('last_name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

@ -1,45 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateTableUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('file_code')->nullable();
$table->enum('user_type', ['natural','juridical'])->default('natural');
$table->string('responsibility')->default('client');
$table->string('father_name')->nullable();
$table->string('website')->nullable();
$table->text('description')->nullable();
$table->unsignedInteger('user_status_id')->nullable();
$table->unsignedInteger('user_title_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('file_code');
$table->dropColumn('user_type');
$table->dropColumn('father_name');
$table->dropColumn('website');
$table->dropColumn('description');
$table->dropColumn('user_status_id');
$table->dropColumn('user_title_id');
});
}
}

@ -1,42 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class NewUpdateTableUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->date('marriage_date')->nullable();
$table->string('company_type', 50)->nullable();
$table->enum('sex', ['male','female'])->nullable();
$table->string('registration_number',50)->nullable();
$table->string('economic_code', 50)->nullable();
$table->timestamp('modified_at')->nullable()->default(\DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('marriage_date');
$table->dropColumn('company_type');
$table->dropColumn('sex');
$table->dropColumn('registration_number');
$table->dropColumn('economic_code');
$table->dropColumn('modified_at');
});
}
}

@ -11,7 +11,15 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// $this->call(ModuleSeeder::class);
$this->call(UserSeeder::class);
$this->call(BusinessSeeder::class);
$this->call(CategorySeeder::class);
$this->call(CitiesSeeder::class);
$this->call(DistrictSeeder::class);
$this->call(DomainSeeder::class);
$this->call(HelpSeeder::class);
$this->call(ModuleSeeder::class);
$this->call(PermissionCategorySeeder::class);
$this->call(RoleSeeder::class);
}
}

Loading…
Cancel
Save