summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-10-03 18:47:25 +0200
committermsquare <msquare@notrademark.de>2018-10-30 21:13:56 +0100
commit689ad7d5d598fd83ab467662cba2a6f5c7a48859 (patch)
tree02b5defe6ca18a62cea006b5e47b09bbdf4d216a /db
parent7f61dc95be4ac543986c7df2459532fd8f81368d (diff)
EventConfig: Use text column instead of json if not supported
Diffstat (limited to 'db')
-rw-r--r--db/migrations/2018_09_24_000000_create_event_config_table.php23
1 files changed, 18 insertions, 5 deletions
diff --git a/db/migrations/2018_09_24_000000_create_event_config_table.php b/db/migrations/2018_09_24_000000_create_event_config_table.php
index 18298100..dd457d3f 100644
--- a/db/migrations/2018_09_24_000000_create_event_config_table.php
+++ b/db/migrations/2018_09_24_000000_create_event_config_table.php
@@ -5,6 +5,7 @@ namespace Engelsystem\Migrations;
use Carbon\Carbon;
use Engelsystem\Database\Migration\Migration;
use Engelsystem\Models\EventConfig;
+use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint;
class CreateEventConfigTable extends Migration
@@ -21,11 +22,23 @@ class CreateEventConfigTable extends Migration
*/
public function up()
{
- $this->schema->create('event_config', function (Blueprint $table) {
- $table->string('name')->index()->unique();
- $table->json('value');
- $table->timestamps();
- });
+ foreach (['json', 'text'] as $type) {
+ try {
+ $this->schema->create('event_config', function (Blueprint $table) use ($type) {
+ $table->string('name')->index()->unique();
+ $table->{$type}('value');
+ $table->timestamps();
+ });
+ } catch (QueryException $e) {
+ if ($type != 'json') {
+ throw $e;
+ }
+
+ continue;
+ }
+
+ break;
+ }
if ($this->schema->hasTable('EventConfig')) {
$config = $this->schema->getConnection()