Separated laravel app to its own folder (#540)

This commit is contained in:
Julien Nahum
2024-08-26 18:24:56 +02:00
committed by GitHub
parent 39b8df5eed
commit 5bd1dda504
546 changed files with 124 additions and 143 deletions

2
api/database/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*.sqlite
*.sqlite-journal

View File

@@ -0,0 +1,96 @@
<?php
namespace Database\Factories;
use App\Models\Forms\Form;
use App\Models\User;
use App\Models\Workspace;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class FormFactory extends Factory
{
protected $model = Form::class;
public function forWorkspace(Workspace $workspace)
{
return $this->state(function (array $attributes) use ($workspace) {
return [
'workspace_id' => $workspace->id,
];
});
}
public function withProperties(array $properties)
{
return $this->state(function (array $attributes) use ($properties) {
return [
'properties' => $properties,
];
});
}
public function createdBy(User $user)
{
return $this->state(function (array $attributes) use ($user) {
return [
'creator_id' => $user->id,
];
});
}
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'title' => $this->faker->text(30),
'description' => $this->faker->randomHtml(1),
'visibility' => 'public',
'theme' => $this->faker->randomElement(Form::THEMES),
'size' => $this->faker->randomElement(Form::SIZES),
'border_radius' => $this->faker->randomElement(Form::BORDER_RADIUS),
'width' => $this->faker->randomElement(Form::WIDTHS),
'dark_mode' => $this->faker->randomElement(Form::DARK_MODE_VALUES),
'color' => '#3B82F6',
'hide_title' => false,
'no_branding' => false,
'uppercase_labels' => true,
'transparent_background' => false,
'submit_button_text' => 'Submit',
'editable_submissions' => false,
're_fillable' => false,
're_fill_button_text' => 'Fill Again',
'submitted_text' => '<p>Amazing, we saved your answers. Thank you for your time and have a great day!</p>',
'use_captcha' => false,
'can_be_indexed' => true,
'password' => false,
'tags' => [],
'editable_submissions_button_text' => 'Edit submission',
'confetti_on_submission' => false,
'seo_meta' => [],
];
}
/**
* Given a Notion database list of properties, format them as the front-end does:
* - Adds id
* - Adds placeholder, prefill, help
* - Adds notion_name
*/
public static function formatProperties($properties): array
{
return collect($properties)->map(function ($property) {
return array_merge($property, [
'id' => Str::uuid(),
'placeholder' => $property['name'],
'prefill' => null,
'help' => 'Please fill this input',
'notion_name' => $property['name'],
]);
})->toArray();
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Database\Factories\Integration;
use App\Models\Integration\FormIntegration;
use Illuminate\Database\Eloquent\Factories\Factory;
class FormIntegrationFactory extends Factory
{
protected $model = FormIntegration::class;
public function definition()
{
return [
'integration_id' => 'i_test',
'status' => 'active',
'logic' => [],
'data' => [],
];
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use App\Models\OAuthProvider;
use Illuminate\Database\Eloquent\Factories\Factory;
class OAuthProviderFactory extends Factory
{
protected $model = OAuthProvider::class;
public function definition()
{
return [
'provider' => 'google',
'provider_user_id' => 'u_test',
'email' => 'user@example.com',
'name' => 'user',
'access_token' => 'ac_test',
'refresh_token' => 're_test',
];
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name,
'email' => $this->faker->unique()->safeEmail,
'hear_about_us' => 'google',
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Workspace>
*/
class WorkspaceFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
'name' => $this->faker->company,
'icon' => '🧪',
];
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password')->nullable();
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateOauthProvidersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oauth_providers', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id')->unsigned();
$table->string('provider');
$table->string('provider_user_id')->index();
$table->string('access_token')->nullable();
$table->string('refresh_token')->nullable();
$table->timestamps();
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('oauth_providers');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('stripe_id')->nullable()->index();
$table->string('pm_type')->nullable();
$table->string('pm_last_four', 4)->nullable();
$table->timestamp('trial_ends_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn([
'stripe_id',
'pm_type',
'pm_last_four',
'trial_ends_at',
]);
});
}
};

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('subscriptions', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id');
$table->string('name');
$table->string('stripe_id')->unique();
$table->string('stripe_status');
$table->string('stripe_price')->nullable();
$table->integer('quantity')->nullable();
$table->timestamp('trial_ends_at')->nullable();
$table->timestamp('ends_at')->nullable();
$table->timestamps();
$table->index(['user_id', 'stripe_status']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('subscriptions');
}
};

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('subscription_items', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('subscription_id');
$table->string('stripe_id')->unique();
$table->string('stripe_product');
$table->string('stripe_price');
$table->integer('quantity')->nullable();
$table->timestamps();
$table->unique(['subscription_id', 'stripe_price']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('subscription_items');
}
};

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateWorkspacesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('workspaces', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('access_token');
$table->string('name');
$table->text('icon')->nullable();
$table->foreignIdFor(\App\Models\User::class, 'user_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('workspaces');
}
}

View File

@@ -0,0 +1,75 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class CreateFormsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::create('forms', function (Blueprint $table) use ($driver) {
$table->id();
$table->foreignIdFor(\App\Models\Workspace::class, 'workspace_id');
$table->string('title');
$table->string('slug');
$table->json('properties');
$table->timestamps();
$table->boolean('notifies')->default(false);
$table->text('description')->nullable();
$table->text('submit_button_text')->default(new Expression("('Submit')"));
$table->boolean('re_fillable')->default(false);
$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(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);
$table->string('logo_picture')->nullable();
$table->string('cover_picture')->nullable();
$table->string('redirect_url')->nullable();
$table->text('custom_code')->nullable();
$table->text('notification_emails')->nullable();
$table->string('theme')->default('default');
$table->jsonb('database_fields_update')->nullable();
$table->string('width')->default('centered');
$table->boolean('transparent_background')->default(false);
$table->timestamp('closes_at')->nullable();
$table->text('closed_text')->nullable();
$table->string('notification_subject')->default('We saved your answers');
$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');
if ($driver === 'mysql') {
$table->jsonb('tags')->default(new Expression('(JSON_ARRAY())'));
} else {
$table->jsonb('tags')->default('[]')->nullable();
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('forms');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class MakeFormsSoftDeletable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropSoftDeletes();
});
}
}

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class CreateFormSubmissionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::create('form_submissions', function (Blueprint $table) use ($driver) {
$table->id();
$table->foreignIdFor(\App\Models\Forms\Form::class, 'form_id');
if ($driver === 'mysql') {
$table->jsonb('data')->default(new Expression('(JSON_OBJECT())'));
} else {
$table->jsonb('data')->default('{}');
}
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('form_submissions');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddHearAboutUsToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('hear_about_us')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('hear_about_us');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFormZapierWebhooksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('form_zapier_webhooks', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Forms\Form::class, 'form_id');
$table->string('hook_url');
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('form_zapier_webhooks');
}
}

View File

@@ -0,0 +1,111 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class CreateUsersWorkspacesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_workspace', function (Blueprint $table) {
$table->id();
$table->foreignId('workspace_id')->references('id')->on('workspaces')->cascadeOnUpdate()->cascadeOnDelete();
$table->foreignId('user_id')->references('id')->on('users')->cascadeOnUpdate()->cascadeOnDelete();
$table->unique(['workspace_id', 'user_id']);
$table->boolean('is_owner')->default(false);
$table->string('access_token')->nullable();
$table->timestamps();
});
// Add creator id to forms table
Schema::table('forms', function (Blueprint $table) {
$table->foreignId('creator_id')->references('id')->on('users')->cascadeOnUpdate()->cascadeOnDelete();
});
// Create relation - can't use models because of new methods clash
DB::table('workspaces')
->orderBy('id')
->chunk(100, function ($workspaces) {
foreach ($workspaces as $workspace) {
echo '.';
// Make sure user wasn't deleted
if (! DB::table('users')->where(
'id',
$workspace->user_id
)->exists()) {
continue;
}
// Create relation
$now = now();
\Illuminate\Support\Facades\DB::table('user_workspace')->insert([
'workspace_id' => $workspace->id,
'access_token' => $workspace->access_token,
'user_id' => $workspace->user_id,
'is_owner' => true,
'created_at' => $now,
'updated_at' => $now,
]);
// Set form creator id
foreach (\App\Models\Forms\Form::withTrashed()->where('workspace_id', $workspace->id)->get() as $form) {
$form->update(['creator_id' => $workspace->user_id]);
}
}
});
// Drop column
Schema::table('workspaces', function (Blueprint $table) {
$table->dropColumn(['user_id', 'access_token']);
});
Schema::table('user_workspace', function (Blueprint $table) {
$table->string('access_token')->nullable(false)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
\Illuminate\Support\Facades\DB::transaction(function () {
Schema::table('workspaces', function (Blueprint $table) {
$table->integer('user_id')->unsigned()->nullable();
$table->string('access_token')->nullable();
$table->foreign('user_id')->references('id')->on('users')
->onDelete('cascade')->onUpdate('cascade');
});
// Remove relation
\App\Models\Workspace::orderBy('id')
->chunk(100, function ($workspaces) {
foreach ($workspaces as $workspace) {
if ($workspace->users()->count() == 0) {
$workspace->delete();
} else {
$workspace->user_id = $workspace->users->first()->id;
$workspace->access_token = $workspace->users()->withPivot('access_token')->first()->pivot->access_token;
$workspace->save();
}
}
});
// Add creator id to forms table
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('creator_id');
});
Schema::dropIfExists('user_workspace');
});
}
}

View File

@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJobBatchesTable extends Migration
{
public function up()
{
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->text('failed_job_ids');
$table->text('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
}
}

View File

@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateWebhookCallsTable extends Migration
{
public function up()
{
Schema::create('webhook_calls', function (Blueprint $table) {
$table->id();
$table->string('external_id')->nullable()->index();
$table->string('name');
$table->json('payload')->nullable();
$table->text('exception')->nullable();
$table->timestamp('processed_at')->nullable();
$table->timestamps();
});
}
}

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIndexesToImportantTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('form_submissions', function (Blueprint $table) {
$table->index('form_id');
});
Schema::table('forms', function (Blueprint $table) {
$table->index('workspace_id');
$table->index('slug');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('form_submissions', function (Blueprint $table) {
$table->dropIndex('form_id');
});
Schema::table('forms', function (Blueprint $table) {
$table->dropIndex('workspace_id');
$table->dropIndex('slug');
});
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('form_views', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Forms\Form::class, 'form_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('form_views');
}
};

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::create('form_statistics', function (Blueprint $table) use ($driver) {
$table->id();
$table->foreignIdFor(\App\Models\Forms\Form::class, 'form_id');
if ($driver === 'mysql') {
$table->jsonb('data')->default(new Expression('(JSON_OBJECT())'));
} else {
$table->jsonb('data')->default('{}');
}
$table->date('date');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('form_statistics');
}
};

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::table('forms', function (Blueprint $table) use ($driver) {
if ($driver === 'mysql') {
$table->jsonb('removed_properties')->default(new Expression('(JSON_ARRAY())'));
} else {
$table->jsonb('removed_properties')->default('[]')->nullable();
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('removed_properties');
});
}
};

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->integer('max_submissions_count')->nullable()->default(null);
$table->string('max_submissions_reached_text')->nullable()->default('This form has now reached the maximum number of allowed submissions and is now closed.');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('max_submissions_count');
$table->dropColumn('max_submissions_reached_text');
});
}
};

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_workspace', function (Blueprint $table) {
$table->dropColumn('access_token');
$table->dropColumn('is_owner');
$table->string('role')->default('admin');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('workspaces', function (Blueprint $table) {
$table->string('access_token')->nullable();
$table->boolean('is_owner')->default(true);
$table->dropColumn('role');
});
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->string('slack_webhook_url')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('slack_webhook_url');
});
}
};

View File

@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::create('templates', function (Blueprint $table) use ($driver) {
$table->id();
$table->timestamps();
$table->string('name');
$table->string('slug');
$table->text('description');
$table->string('image_url');
if ($driver === 'mysql') {
$table->jsonb('structure')->default(new Expression('(JSON_OBJECT())'));
} else {
$table->jsonb('structure')->default('{}');
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('templates');
}
};

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::table('templates', function (Blueprint $table) use ($driver) {
if ($driver === 'mysql') {
$table->jsonb('questions')->default(new Expression('(JSON_ARRAY())'));
} else {
$table->jsonb('questions')->default('[]');
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('templates', function (Blueprint $table) {
$table->dropColumn('questions');
});
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->string('visibility')->default('public');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('visibility');
});
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->boolean('editable_submissions')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('editable_submissions');
});
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->string('discord_webhook_url')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('discord_webhook_url');
});
}
};

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$driver = DB::getDriverName();
if ($driver === 'mysql') {
$table->text('max_submissions_reached_text')->nullable()->default(new Expression("('This form has now reached the maximum number of allowed submissions and is now closed.')"))->change();
} else {
$table->text('max_submissions_reached_text')->nullable()->default('This form has now reached the maximum number of allowed submissions and is now closed.')->change();
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
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();
});
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->text('editable_submissions_button_text')->default(new Expression("('Edit submission')"));
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('editable_submissions_button_text');
});
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('templates', function (Blueprint $table) {
// Make image_url nullable
$table->string('image_url')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('templates', function (Blueprint $table) {
$table->string('image_url')->nullable(false)->change();
});
}
};

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ai_form_completions', function (Blueprint $table) {
$table->id();
$table->string('form_prompt');
$table->string('status');
$table->json('result')->nullable();
$table->string('ip');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ai_form_completions');
}
};

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->boolean('confetti_on_submission')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('confetti_on_submission');
});
}
};

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::table('forms', function (Blueprint $table) use ($driver) {
if ($driver === 'mysql') {
$table->json('seo_meta')->default(new Expression('(JSON_OBJECT())'));
} else {
$table->json('seo_meta')->default('{}');
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('seo_meta');
});
}
};

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::table('forms', function (Blueprint $table) use ($driver) {
if ($driver === 'mysql') {
$table->json('notification_settings')->default(new Expression('(JSON_OBJECT())'))->nullable(true);
} else {
$table->json('notification_settings')->default('{}')->nullable(true);
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('notification_settings');
});
}
};

View File

@@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::table('templates', function (Blueprint $table) use ($driver) {
$table->boolean('publicly_listed')->default(false);
if ($driver === 'mysql') {
$table->jsonb('industries')->default(new Expression('(JSON_ARRAY())'));
} else {
$table->jsonb('industries')->default('[]');
}
if ($driver === 'mysql') {
$table->jsonb('types')->default(new Expression('(JSON_ARRAY())'));
} else {
$table->jsonb('types')->default('[]');
}
$table->string('short_description')->nullable();
if ($driver === 'mysql') {
$table->jsonb('related_templates')->default(new Expression('(JSON_ARRAY())'));
} else {
$table->jsonb('related_templates')->default('[]');
}
$table->string('image_url', 500)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('templates', function (Blueprint $table) {
$table->dropColumn(['publicly_listed', 'industries', 'types', 'short_description', 'related_templates']);
});
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('templates', function (Blueprint $table) {
$table->foreignIdFor(\App\Models\User::class, 'creator_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('templates', function (Blueprint $table) {
$table->dropColumn('creator_id');
});
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->boolean('auto_save')->default(true);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('auto_save');
});
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('ai_form_completions', function (Blueprint $table) {
$table->text('form_prompt')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('ai_form_completions', function (Blueprint $table) {
$table->string('form_prompt')->change();
});
}
};

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('licenses', function (Blueprint $table) {
$table->id();
$table->string('license_key');
$table->unsignedBigInteger('user_id')->nullable();
$table->string('license_provider');
$table->string('status');
$table->json('meta');
$table->timestamps();
$table->index(['license_key', 'license_provider']);
$table->index(['user_id', 'license_provider']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('licenses');
}
};

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::table('workspaces', function (Blueprint $table) use ($driver) {
if ($driver === 'mysql') {
$table->json('custom_domains')->default(new Expression('(JSON_OBJECT())'))->nullable(true);
} else {
$table->json('custom_domains')->default('{}')->nullable(true);
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('workspaces', function (Blueprint $table) {
$table->dropColumn('custom_domains');
});
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->string('custom_domain')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn(['custom_domain']);
});
}
};

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::create('form_integrations', function (Blueprint $table) use ($driver) {
$table->id();
$table->foreignIdFor(\App\Models\Forms\Form::class, 'form_id');
$table->string('status');
$table->string('integration_id');
if ($driver === 'mysql') {
$table->jsonb('logic')->default(new Expression("(JSON_OBJECT())"));
$table->jsonb('data')->default(new Expression("(JSON_OBJECT())"));
} else {
$table->jsonb('logic')->default('{}');
$table->jsonb('data')->default('{}');
}
$table->string('oauth_id')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('form_integrations');
}
};

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$driver = DB::getDriverName();
Schema::create('form_integrations_events', function (Blueprint $table) use ($driver) {
$table->id();
$table->foreignIdFor(\App\Models\Integration\FormIntegration::class, 'integration_id');
$table->string('status');
if ($driver === 'mysql') {
$table->jsonb('data')->default(new Expression("(JSON_OBJECT())"));
} else {
$table->jsonb('data')->default('{}');
}
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('form_integrations_events');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->boolean('show_progress_bar')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('show_progress_bar');
});
}
};

View File

@@ -0,0 +1,61 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn([
'notifies',
'notification_emails',
'send_submission_confirmation',
'notification_sender',
'notification_subject',
'notification_body',
'notifications_include_submission',
'slack_webhook_url',
'discord_webhook_url',
'webhook_url',
'notification_settings'
]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$driver = DB::getDriverName();
Schema::table('forms', function (Blueprint $table) use ($driver) {
$table->boolean('notifies')->default(false);
$table->text('notification_emails')->nullable();
$table->boolean('send_submission_confirmation')->default(false);
$table->string('notification_sender')->default('OpenForm');
$table->string('notification_subject')->default('We saved your answers');
$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->string('slack_webhook_url')->nullable();
$table->string('discord_webhook_url')->nullable();
$table->string('webhook_url')->nullable();
if ($driver === 'mysql') {
$table->json('notification_settings')->default(new Expression('(JSON_OBJECT())'))->nullable(true);
} else {
$table->json('notification_settings')->default('{}')->nullable(true);
}
});
}
};

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('oauth_providers', function (Blueprint $table) {
$table->string('email')->after('provider_user_id')->nullable();
$table->string('name')->after('email')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('oauth_providers', function (Blueprint $table) {
$table->dropColumn('email');
$table->dropColumn('name');
});
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('oauth_providers', function (Blueprint $table) {
$table->timestamp('token_expires_at')->nullable()->after('refresh_token');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('oauth_providers', function (Blueprint $table) {
$table->dropColumn('token_expires_at');
});
}
};

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('subscriptions', function (Blueprint $table) {
$table->renameColumn('name', 'type');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('subscriptions', function (Blueprint $table) {
$table->renameColumn('type', 'name');
});
}
};

View File

@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::rename('password_resets', 'password_reset_tokens');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::rename('password_reset_tokens', 'password_resets');
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('user_invites', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Workspace::class, 'workspace_id');
$table->string('email');
$table->string('role')->default('user');
$table->string('token', 191)->unique();
$table->string('status')->default(\App\Models\UserInvite::PENDING_STATUS);
$table->dateTime('valid_until')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('user_invites');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('forms', function (Blueprint $table) {
$table->string('size')->default('md');
$table->string('border_radius')->default('small');
});
// Then for each form with "Simple" theme on, disable border radius
\App\Models\Forms\Form::whereTheme('simple')->update(['border_radius' => 'none']);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn(['size', 'border_radius']);
});
}
};

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('forms', function (Blueprint $table) {
$table->string('font_family')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn(['font_family']);
});
}
};

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('forms', function (Blueprint $table) {
$table->boolean('auto_focus')->default(true);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('forms', function (Blueprint $table) {
$table->dropColumn('auto_focus');
});
}
};

View File

@@ -0,0 +1,18 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
// \App\Models\User::factory(10)->create();
}
}