feat: add support for MySQL (#238)
* ci: run tests on mysql * adapt migration to support default values on MySQL --------- Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -22,14 +23,14 @@ class CreateFormsTable extends Migration
|
||||
$table->timestamps();
|
||||
$table->boolean('notifies')->default(false);
|
||||
$table->text('description')->nullable();
|
||||
$table->text('submit_button_text')->default('Submit');
|
||||
$table->text('submit_button_text')->default(new Expression("('Submit')"));
|
||||
$table->boolean('re_fillable')->default(false);
|
||||
$table->text('re_fill_button_text')->default('Fill Again');
|
||||
$table->text('re_fill_button_text')->default(new Expression("('Fill Again')"));
|
||||
$table->string('color')->default('#3B82F6');
|
||||
$table->boolean('uppercase_labels')->default(true);
|
||||
$table->boolean('no_branding')->default(false);
|
||||
$table->boolean('hide_title')->default(false);
|
||||
$table->text('submitted_text')->default('Amazing, we saved your answers. Thank you for your time and have a great day!');
|
||||
$table->text('submitted_text')->default(new Expression("('Amazing, we saved your answers. Thank you for your time and have a great day!')"));
|
||||
$table->string('dark_mode')->default('auto');
|
||||
$table->string('webhook_url')->nullable();
|
||||
$table->boolean('send_submission_confirmation')->default(false);
|
||||
@@ -45,13 +46,13 @@ class CreateFormsTable extends Migration
|
||||
$table->timestamp('closes_at')->nullable();
|
||||
$table->text('closed_text')->nullable();
|
||||
$table->string('notification_subject')->default("We saved your answers");
|
||||
$table->text('notification_body')->default('<p>Hello there 👋 <br>This is a confirmation that your submission was successfully saved.</p>');
|
||||
$table->text('notification_body')->default(new Expression("('<p>Hello there 👋 <br>This is a confirmation that your submission was successfully saved.</p>')"));
|
||||
$table->boolean('notifications_include_submission')->default(true);
|
||||
$table->boolean('use_captcha')->default(false);
|
||||
$table->boolean('can_be_indexed')->default(true);
|
||||
$table->string('password')->nullable()->default(null);
|
||||
$table->string('notification_sender')->default("OpenForm");
|
||||
$table->jsonb('tags')->default('[]');
|
||||
$table->jsonb('tags')->default(new Expression('(JSON_ARRAY())'));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -16,7 +17,7 @@ class CreateFormSubmissionsTable extends Migration
|
||||
Schema::create('form_submissions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(\App\Models\Forms\Form::class,'form_id');
|
||||
$table->jsonb('data')->default('{}');
|
||||
$table->jsonb('data')->default(new Expression("(JSON_OBJECT())"));
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -16,7 +17,7 @@ return new class extends Migration
|
||||
Schema::create('form_statistics', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(\App\Models\Forms\Form::class,'form_id');
|
||||
$table->jsonb('data')->default('{}');
|
||||
$table->jsonb('data')->default(new Expression("(JSON_OBJECT())"));
|
||||
$table->date('date');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -14,7 +15,7 @@ return new class extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table('forms', function (Blueprint $table) {
|
||||
$table->jsonb('removed_properties')->default('[]');
|
||||
$table->jsonb('removed_properties')->default(new Expression("(JSON_ARRAY())"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -20,7 +21,7 @@ return new class extends Migration
|
||||
$table->string('slug');
|
||||
$table->text('description');
|
||||
$table->string('image_url');
|
||||
$table->jsonb('structure')->default('{}');
|
||||
$table->jsonb('structure')->default(new Expression("(JSON_OBJECT())"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -14,7 +15,7 @@ return new class extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table('templates', function (Blueprint $table) {
|
||||
$table->jsonb('questions')->default('{}');
|
||||
$table->jsonb('questions')->default(new Expression("(JSON_ARRAY())"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -14,7 +15,7 @@ return new class extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table('forms', function (Blueprint $table) {
|
||||
$table->text('editable_submissions_button_text')->default('Edit submission');
|
||||
$table->text('editable_submissions_button_text')->default(new Expression("('Edit submission')"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -14,7 +15,7 @@ return new class extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table('forms', function (Blueprint $table) {
|
||||
$table->json('seo_meta')->default('{}');
|
||||
$table->json('seo_meta')->default(new Expression("(JSON_OBJECT())"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -14,7 +15,7 @@ return new class extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table('forms', function (Blueprint $table) {
|
||||
$table->json('notification_settings')->default('{}')->nullable(true);
|
||||
$table->json('notification_settings')->default(new Expression("(JSON_OBJECT())"))->nullable(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -15,10 +16,10 @@ return new class extends Migration
|
||||
{
|
||||
Schema::table('templates', function (Blueprint $table) {
|
||||
$table->boolean('publicly_listed')->default(false);
|
||||
$table->jsonb('industries')->default('[]');
|
||||
$table->jsonb('types')->default('[]');
|
||||
$table->jsonb('industries')->default(new Expression("(JSON_ARRAY())"));
|
||||
$table->jsonb('types')->default(new Expression("(JSON_ARRAY())"));
|
||||
$table->string('short_description')->nullable();
|
||||
$table->jsonb('related_templates')->default('[]');
|
||||
$table->jsonb('related_templates')->default(new Expression("(JSON_ARRAY())"));
|
||||
$table->string('image_url',500)->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user