DB Config

This commit is contained in:
Kilian Hofmann 2021-08-14 12:57:12 +02:00
parent 37fff25f0d
commit 3a75eeb51f
4 changed files with 63 additions and 0 deletions

View File

@ -1,5 +1,6 @@
<?php namespace GermanAirlinesVa\Social;
use Config;
use System\Classes\PluginBase;
class Plugin extends PluginBase
@ -11,4 +12,9 @@ class Plugin extends PluginBase
public function registerSettings()
{
}
public function boot()
{
Config::set('database.connections.germanairlinesva_social', Config::get('germanairlinesva.social::connection'));
}
}

25
config/config.php Normal file
View File

@ -0,0 +1,25 @@
<?php
return [
'connection' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => 'germanairlinesva_social',
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => 'InnoDB',
'options' => extension_loaded('pdo_mysql')
? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
])
: [],
],
];

View File

@ -0,0 +1,30 @@
<?php namespace GermanAirlinesVa\Fleet\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateGermanAirlinesVaSchoolingDeferredBindings extends Migration
{
public function up()
{
Schema::connection('germanairlinesva_social')->create('deferred_bindings', function ($table) {
$table->engine = 'InnoDB';
$table->increments('id')->unsigned();
$table->string('master_type');
$table->string('master_field');
$table->string('slave_type');
$table->integer('slave_id');
$table->mediumText('pivot_data')->nullable();
$table->string('session_key');
$table->boolean('is_bind')->default(true);
$table->timestamps();
});
}
public function down()
{
Schema::connection('germanairlinesva_social')->disableForeignKeyConstraints();
Schema::connection('germanairlinesva_social')->dropIfExists('deferred_bindings');
Schema::connection('germanairlinesva_social')->enableForeignKeyConstraints();
}
}

View File

@ -1,2 +1,4 @@
1.0.1:
- Initialize plugin.
- 'Create table deferred_bindings'
- builder_table_create_deferred_bindings.php