diff --git a/Plugin.php b/Plugin.php index d06519b..50e54a9 100644 --- a/Plugin.php +++ b/Plugin.php @@ -45,6 +45,8 @@ class Plugin extends PluginBase }); \Illuminate\Support\Facades\Broadcast::routes(['prefix' => '', 'middleware' => 'GermanAirlinesVA\\Graphql\\Classes\\Authentication']); require("channels/channels.php"); + + Config::set('database.connections.germanairlinesva_graphql', Config::get('germanairlinesva.graphql::connection')); } public function bootPackages() diff --git a/README.md b/README.md new file mode 100644 index 0000000..4d3f7b8 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Relations + +## GraphQLKeys + +- **TODO** BelongsTo Member (External DB) diff --git a/config/config.php b/config/config.php index 259f4b7..6248d20 100644 --- a/config/config.php +++ b/config/config.php @@ -4,6 +4,27 @@ use Cms\Classes\Theme; use GermanAirlinesVa\Graphql\Models\Settings; return [ + 'connection' => [ + 'driver' => 'mysql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => 'germanairlinesva_graphql', + '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'), + ]) + : [], + ], 'packages' => [ 'nuwave/lighthouse' => [ 'config_namespace' => 'lighthouse', diff --git a/updates/README.md b/updates/README.md new file mode 100644 index 0000000..4d3f7b8 --- /dev/null +++ b/updates/README.md @@ -0,0 +1,5 @@ +# Relations + +## GraphQLKeys + +- **TODO** BelongsTo Member (External DB) diff --git a/updates/builder_table_create_deferred_bindings.php b/updates/builder_table_create_deferred_bindings.php new file mode 100644 index 0000000..d20d5fb --- /dev/null +++ b/updates/builder_table_create_deferred_bindings.php @@ -0,0 +1,31 @@ +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_graphql')->disableForeignKeyConstraints(); + Schema::connection('germanairlinesva_graphql')->dropIfExists('deferred_bindings'); + Schema::connection('germanairlinesva_graphql')->enableForeignKeyConstraints(); + } +} diff --git a/updates/builder_table_create_graphql_keys.php b/updates/builder_table_create_graphql_keys.php new file mode 100644 index 0000000..750bdbb --- /dev/null +++ b/updates/builder_table_create_graphql_keys.php @@ -0,0 +1,26 @@ +create('graphql_keys', function ($table) { + $table->engine = 'InnoDB'; + $table->bigIncrements('id')->unsigned(); + $table->datetime('valid_from')->default(DB::raw('NOW()')); + $table->datetime('valid_to')->default(DB::raw('NOW()')); + $table->string('key'); + }); + } + + public function down() + { + Schema::connection('germanairlinesva_graphql')->disableForeignKeyConstraints(); + Schema::connection('germanairlinesva_graphql')->dropIfExists('graphql_keys'); + Schema::connection('germanairlinesva_graphql')->enableForeignKeyConstraints(); + } +} diff --git a/updates/version.yaml b/updates/version.yaml index 1894fd0..d099390 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -1,2 +1,4 @@ 1.0.1: - - Initialize plugin. + - 'Initialize plugin.' + - 'Create table deferred_bindings' + - builder_table_create_deferred_bindings.php