Skip to content

Commit

Permalink
fix : Added MySQL support #171
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Singh <[email protected]>
  • Loading branch information
talktogauravsingh committed Sep 30, 2023
1 parent 4fe33b3 commit 92ebcfb
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 18 deletions.
16 changes: 16 additions & 0 deletions app/Models/Forms/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,22 @@ class Form extends Model
'removed_properties'
];

/**
* Default values
*/
protected $attributes = [
'submit_button_text' => 'Submit',
're_fill_button_text' => 'Fill Again',
'submitted_text' => 'Amazing, we saved your answers. Thank you for your time and have a great day!',
'notification_body' => '<p>Hello there 👋 <br>This is a confirmation that your submission was successfully saved.</p>',
'tags' => '[]',
'removed_properties' => '[]',
'max_submissions_reached_text' => 'This form has now reached the maximum number of allowed submissions and is now closed.',
'editable_submissions_button_text' => 'Edit submission',
'seo_meta' => '{}',
'notification_settings' => '{}'
];

/**
* The event map for the model.
*
Expand Down
7 changes: 7 additions & 0 deletions app/Models/Forms/FormStatistic.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class FormStatistic extends Model
'data' => 'array',
];

/**
* Set Default values
*/
protected $attributes = [
'data' => '{}'
];

/**
* Relationships
*/
Expand Down
7 changes: 7 additions & 0 deletions app/Models/Forms/FormSubmission.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ class FormSubmission extends Model
'data' => 'array'
];

/**
* Default values
*/
protected $attributes = [
'data' => '{}'
];

/**
* RelationShips
*/
Expand Down
8 changes: 8 additions & 0 deletions app/Models/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,16 @@ class Template extends Model
'updated_at' => 'datetime',
];

/**
* Default values
*/
protected $attributes = [
'publicly_listed' => false,
'structure' => '{}',
'questions' => '{}',
'industries' => '[]',
'types' => '[]',
'related_templates' => '[]',
];

public function setDescriptionAttribute($value)
Expand Down
10 changes: 5 additions & 5 deletions database/migrations/2021_05_19_140326_create_forms_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public function up()
$table->timestamps();
$table->boolean('notifies')->default(false);
$table->text('description')->nullable();
$table->text('submit_button_text')->default('Submit');
$table->text('submit_button_text')->nullable();
$table->boolean('re_fillable')->default(false);
$table->text('re_fill_button_text')->default('Fill Again');
$table->text('re_fill_button_text')->nullable();
$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')->nullable();
$table->string('dark_mode')->default('auto');
$table->string('webhook_url')->nullable();
$table->boolean('send_submission_confirmation')->default(false);
Expand All @@ -45,13 +45,13 @@ public function up()
$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')->nullable();
$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')->nullable();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function up()
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')->nullable();
$table->timestamps();
});
}
Expand Down
2 changes: 1 addition & 1 deletion database/migrations/2022_05_10_144947_form_statistic.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function up()
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')->nullable();
$table->date('date');
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->jsonb('removed_properties')->default('[]');
$table->jsonb('removed_properties')->nullable();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function up()
$table->string('slug');
$table->text('description');
$table->string('image_url');
$table->jsonb('structure')->default('{}');
$table->jsonb('structure')->nullable();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public function up()
{
Schema::table('templates', function (Blueprint $table) {
$table->jsonb('questions')->default('{}');
$table->jsonb('questions')->nullable();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->text('max_submissions_reached_text')->nullable()->default('This form has now reached the maximum number of allowed submissions and is now closed.')->change();
$table->text('max_submissions_reached_text')->nullable()->change();
});
}

Expand All @@ -26,7 +26,7 @@ public function up()
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->string('max_submissions_reached_text')->nullable()->default('This form has now reached the maximum number of allowed submissions and is now closed.')->change();
$table->string('max_submissions_reached_text')->nullable()->change();
});
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->text('editable_submissions_button_text')->default('Edit submission');
$table->text('editable_submissions_button_text')->nullable();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->json('seo_meta')->default('{}');
$table->json('seo_meta')->nullable();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->json('notification_settings')->default('{}')->nullable(true);
$table->json('notification_settings')->nullable(true);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public function up()
{
Schema::table('templates', function (Blueprint $table) {
$table->boolean('publicly_listed')->default(false);
$table->jsonb('industries')->default('[]');
$table->jsonb('types')->default('[]');
$table->jsonb('industries')->nullable();
$table->jsonb('types')->nullable();
$table->string('short_description')->nullable();
$table->jsonb('related_templates')->default('[]');
$table->jsonb('related_templates')->nullable();
$table->string('image_url',500)->nullable()->change();
});
}
Expand Down

0 comments on commit 92ebcfb

Please sign in to comment.