Fixed migrations and seeders

This commit is contained in:
Manish Verma
2018-08-10 15:31:35 +05:30
parent 379ef26ddd
commit 2f5243c1f3
11 changed files with 112 additions and 69 deletions

View File

@@ -98,7 +98,10 @@ class InstallerApiController extends Controller
$ENV['CACHE_DRIVER'] = 'file';
$ENV['SESSION_DRIVER'] = 'file';
$ENV['QUEUE_DRIVER'] = 'sync';
$ENV['JWT_TTL'] = 4;
$ENV['FCM_SERVER_KEY'] = 'AIzaSyCyx5OFnsRFUmDLTMbPV50ZMDUGSG-bLw4';
$ENV['FCM_SENDER_ID'] = '661051343223';
$ENV['REDIS_DATABASE'] = '0';
$config = '';
foreach ($ENV as $key => $val) {
@@ -168,7 +171,7 @@ class InstallerApiController extends Controller
Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true]);
Artisan::call('key:generate');
Artisan::call('jwt:secret');
// checking requested timezone for the admin and system
$timezones = Timezones::where('name', '=', $timezone)->first();
if ($timezones == null) {

View File

@@ -443,7 +443,7 @@ class InstallController extends Controller
$ENV['SESSION_DRIVER'] = 'file';
$ENV['SESSION_COOKIE_NAME'] = 'faveo_'.rand(0, 10000);
$ENV['QUEUE_DRIVER'] = 'sync';
$ENV['JWT_TTL'] = 4;
$ENV['FCM_SERVER_KEY'] = 'AIzaSyCyx5OFnsRFUmDLTMbPV50ZMDUGSG-bLw4';
$ENV['FCM_SENDER_ID'] = '661051343223';
$ENV['REDIS_DATABASE'] = '0';

View File

@@ -13,21 +13,15 @@ class CreateMailServicesTable extends Migration
*/
public function up()
{
Schema::create('mail_services', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('short_name');
$table->timestamps();
});
$mail = new MailService();
$services = ['smtp'=>'SMTP', 'mail'=>'Php Mail', 'sendmail'=>'Send Mail', 'mailgun'=>'Mailgun', 'mandrill'=>'Mandrill', 'log'=>'Log file'];
foreach ($services as $key=>$value) {
$mail->create([
'name' => $value,
'short_name'=> $key,
]);
}
Schema::create(
'mail_services',
function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('short_name');
$table->timestamps();
}
);
}
/**

View File

@@ -13,28 +13,16 @@ class CreateQueueServicesTable extends Migration
*/
public function up()
{
Schema::create('queue_services', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('short_name');
$table->integer('status');
$table->timestamps();
});
$queue = new QueueService();
$services = ['sync'=>'Sync', 'database'=>'Database', 'beanstalkd'=>'Beanstalkd', 'sqs'=>'SQS', 'iron'=>'Iron', 'redis'=>'Redis'];
foreach ($services as $key=>$value) {
$queue->create([
'name' => $value,
'short_name'=> $key,
'status' => 0,
]);
}
$q = $queue->where('short_name', 'sync')->first();
if ($q) {
$q->status = 1;
$q->save();
}
Schema::create(
'queue_services',
function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('short_name');
$table->integer('status');
$table->timestamps();
}
);
}
/**

View File

@@ -13,28 +13,13 @@ class AlterTicketSourceTable extends Migration
public function up()
{
if (!Schema::hasColumn('ticket_source', 'css_class')) {
Schema::table('ticket_source', function (Blueprint $table) {
$table->string('css_class');
});
Schema::table(
'ticket_source',
function (Blueprint $table) {
$table->string('css_class');
}
);
}
DB::table('ticket_source')->delete();
$values = $this->values();
foreach ($values as $value) {
DB::table('ticket_source')->insert($value);
}
}
public function values()
{
return[
['name' => 'web', 'value' => 'Web', 'css_class' => 'fa fa-internet-explorer'],
['name' => 'email', 'value' => 'E-mail', 'css_class' => 'fa fa-envelope'],
['name' => 'agent', 'value' => 'Agent Panel', 'css_class' => 'fa fa-envelope'],
['name' => 'facebook', 'value' => 'Facebook', 'css_class' => 'fa fa-facebook'],
['name' => 'twitter', 'value' => 'Twitter', 'css_class' => 'fa fa-twitter'],
['name' => 'call', 'value' => 'Call', 'css_class' => 'fa fa-phone'],
['name' => 'chat', 'value' => 'Chat', 'css_class' => 'fa fa-comment'],
];
}
/**

View File

@@ -13,9 +13,12 @@ class AlterUsersTableAddUserLanguageColumn extends Migration
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('user_language', 10)->default(null)->nullable();
});
Schema::table(
'users',
function (Blueprint $table) {
$table->string('user_language', 10)->default(null)->nullable();
}
);
}
/**

View File

@@ -20,7 +20,6 @@ use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Settings\Ticket;
use App\Model\helpdesk\Theme\Widgets;
use App\Model\helpdesk\Ticket\Ticket_Priority;
use App\Model\helpdesk\Ticket\Ticket_source;
use App\Model\helpdesk\Ticket\Ticket_Status;
use App\Model\helpdesk\Utility\CountryCode;
use App\Model\helpdesk\Utility\Date_format;
@@ -272,10 +271,7 @@ class DatabaseSeeder extends Seeder
Responder::create(['id' => '1', 'new_ticket' => '1', 'agent_new_ticket' => '1']);
System::create(['id' => '1', 'status' => '1', 'department' => '1', 'date_time_format' => '1', 'time_zone' => '32']);
Ticket::create(['num_format' => '$$$$-####-####', 'num_sequence' => 'sequence', 'collision_avoid' => '2', 'priority' => '1', 'sla' => '2', 'help_topic' => '1', 'status' => '1']);
/* Ticket source */
Ticket_source::create(['name' => 'web', 'value' => 'Web']);
Ticket_source::create(['name' => 'email', 'value' => 'E-mail']);
Ticket_source::create(['name' => 'agent', 'value' => 'Agent Panel']);
/* Version check */
Version_Check::create(['id' => '1']);
/* System widgets */
@@ -2029,5 +2025,7 @@ class DatabaseSeeder extends Seeder
Limit_Login::create(['id' => '1']);
$this->call(UserSeeder::class);
$this->call(TicketSourceSeeder::class);
$this->call(OutboundMailSeeder::class);
}
}

View File

@@ -0,0 +1,40 @@
<?php
use App\Model\MailJob\MailService;
use App\Model\MailJob\QueueService;
use Illuminate\Database\Seeder;
class OutboundMailSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$mail = new MailService();
$mail_services = ['smtp' => 'SMTP', 'mail' => 'Php Mail', 'sendmail' => 'Send Mail', 'mailgun' => 'Mailgun', 'mandrill' => 'Mandrill', 'log' => 'Log file'];
foreach ($mail_services as $key => $value) {
$mail->create([
'name' => $value,
'short_name' => $key,
]);
}
$queue = new QueueService();
$services = ['sync' => 'Sync', 'database' => 'Database', 'beanstalkd' => 'Beanstalkd', 'sqs' => 'SQS', 'iron' => 'Iron', 'redis' => 'Redis'];
foreach ($services as $key => $value) {
$queue->create([
'name' => $value,
'short_name' => $key,
'status' => 0,
]);
}
$q = $queue->where('short_name', 'sync')->first();
if ($q) {
$q->status = 1;
$q->save();
}
}
}

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Seeder;
use App\Model\helpdesk\Ticket\Ticket_source;
class TicketSourceSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
\DB::statement('SET FOREIGN_KEY_CHECKS=0;');
Ticket_source::truncate();
\DB::statement('SET FOREIGN_KEY_CHECKS=1;');
Ticket_source::create(['name' => 'Web', 'value' => 'Web', 'css_class' => 'fa fa-globe',]);
Ticket_source::create(['name' => 'Email', 'value' => 'E-mail', 'css_class' => 'fa fa-envelope',]);
Ticket_source::create(['name' => 'Agent', 'value' => 'Agent Panel', 'css_class' => 'fa fa-user',]);
Ticket_source::create(['name' => 'Facebook', 'value' => 'Facebook', 'css_class' => 'fa fa-facebook',]);
Ticket_source::create(['name' => 'Twitter', 'value' => 'Twitter', 'css_class' => 'fa fa-twitter',]);
Ticket_source::create(['name' => 'Call', 'value' => 'Call', 'css_class' => 'fa fa-phone',]);
Ticket_source::create(['name' => 'Chat', 'value' => 'Chat', 'css_class' => 'fa fa-comment',]);
}
}

View File

@@ -212,6 +212,7 @@ return array(
'Null_Frame_Decorator' => $vendorDir . '/dompdf/dompdf/include/null_frame_decorator.cls.php',
'Null_Frame_Reflower' => $vendorDir . '/dompdf/dompdf/include/null_frame_reflower.cls.php',
'Null_Positioner' => $vendorDir . '/dompdf/dompdf/include/null_positioner.cls.php',
'OutboundMailSeeder' => $baseDir . '/database/seeds/OutboundMailSeeder.php',
'PDFLib_Adapter' => $vendorDir . '/dompdf/dompdf/include/pdflib_adapter.cls.php',
'PHPUnit\\Exception' => $vendorDir . '/phpunit/phpunit/src/Exception.php',
'PHPUnit\\Framework\\Assert' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert.php',
@@ -777,6 +778,7 @@ return array(
'TheSeer\\Tokenizer\\TokenCollectionException' => $vendorDir . '/theseer/tokenizer/src/TokenCollectionException.php',
'TheSeer\\Tokenizer\\Tokenizer' => $vendorDir . '/theseer/tokenizer/src/Tokenizer.php',
'TheSeer\\Tokenizer\\XMLSerializer' => $vendorDir . '/theseer/tokenizer/src/XMLSerializer.php',
'TicketSourceSeeder' => $baseDir . '/database/seeds/TicketSourceSeeder.php',
'UserSeeder' => $baseDir . '/database/seeds/UserSeeder.php',
'Version1079table' => $baseDir . '/database/migrations/2016_06_28_141613_version1079table.php',
);

View File

@@ -871,6 +871,7 @@ class ComposerStaticInit598add4b9b35c76d3599603201ccdd6d
'Null_Frame_Decorator' => __DIR__ . '/..' . '/dompdf/dompdf/include/null_frame_decorator.cls.php',
'Null_Frame_Reflower' => __DIR__ . '/..' . '/dompdf/dompdf/include/null_frame_reflower.cls.php',
'Null_Positioner' => __DIR__ . '/..' . '/dompdf/dompdf/include/null_positioner.cls.php',
'OutboundMailSeeder' => __DIR__ . '/../..' . '/database/seeds/OutboundMailSeeder.php',
'PDFLib_Adapter' => __DIR__ . '/..' . '/dompdf/dompdf/include/pdflib_adapter.cls.php',
'PHPUnit\\Exception' => __DIR__ . '/..' . '/phpunit/phpunit/src/Exception.php',
'PHPUnit\\Framework\\Assert' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert.php',
@@ -1436,6 +1437,7 @@ class ComposerStaticInit598add4b9b35c76d3599603201ccdd6d
'TheSeer\\Tokenizer\\TokenCollectionException' => __DIR__ . '/..' . '/theseer/tokenizer/src/TokenCollectionException.php',
'TheSeer\\Tokenizer\\Tokenizer' => __DIR__ . '/..' . '/theseer/tokenizer/src/Tokenizer.php',
'TheSeer\\Tokenizer\\XMLSerializer' => __DIR__ . '/..' . '/theseer/tokenizer/src/XMLSerializer.php',
'TicketSourceSeeder' => __DIR__ . '/../..' . '/database/seeds/TicketSourceSeeder.php',
'UserSeeder' => __DIR__ . '/../..' . '/database/seeds/UserSeeder.php',
'Version1079table' => __DIR__ . '/../..' . '/database/migrations/2016_06_28_141613_version1079table.php',
);