updated to laravel 11
This commit is contained in:
75
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
75
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->boolean('admin')->default(false);
|
||||
$table->string('firstname')->nullable();
|
||||
$table->string('surname')->nullable();
|
||||
$table->string('phone')->nullable();
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->rememberToken();
|
||||
|
||||
$table->string('home_address')->nullable();
|
||||
$table->string('home_address2')->nullable();
|
||||
$table->string('home_city')->nullable();
|
||||
$table->string('home_state')->nullable();
|
||||
$table->string('home_postcode')->nullable();
|
||||
$table->string('home_country')->nullable();
|
||||
|
||||
$table->string('billing_address')->nullable();
|
||||
$table->string('billing_address2')->nullable();
|
||||
$table->string('billing_city')->nullable();
|
||||
$table->string('billing_state')->nullable();
|
||||
$table->string('billing_postcode')->nullable();
|
||||
$table->string('billing_country')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
});
|
||||
|
||||
Schema::create('login_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('email');
|
||||
$table->string('token')->unique();
|
||||
$table->string('intended_url')->nullable();
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal 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.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
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->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
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.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('username')->unique();
|
||||
$table->string('password')->nullable();
|
||||
$table->boolean('enabled')->default(true);
|
||||
$table->string('first_name');
|
||||
$table->string('last_name');
|
||||
$table->string('email');
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('phone')->nullable();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
<?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('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.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
<?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->uuidMorphs('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');
|
||||
}
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
<?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('permissions', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('permission');
|
||||
$table->uuid('user_id');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('permissions');
|
||||
}
|
||||
};
|
||||
@@ -1,38 +0,0 @@
|
||||
<?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('events', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('title');
|
||||
$table->string('location');
|
||||
$table->string('address')->nullable();
|
||||
$table->timestamp('start_at')->useCurrent();
|
||||
$table->timestamp('end_at')->useCurrent();
|
||||
$table->timestamp('publish_at')->useCurrent()->nullable();
|
||||
$table->string('status')->default('draft');
|
||||
$table->string('registration_type');
|
||||
$table->string('registration_data')->nullable();
|
||||
$table->uuid('hero');
|
||||
$table->text('content')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('events');
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
<?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('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.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
<?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_codes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->char('code', 6)->unique();
|
||||
$table->string('action');
|
||||
$table->string('data')->nullable();
|
||||
$table->uuid('user_id');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_codes');
|
||||
}
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::connection(config('audit.drivers.database.connection', config('database.default')))->create('audits', function (Blueprint $table) {
|
||||
|
||||
$morphPrefix = Config::get('audit.user.morph_prefix', 'user');
|
||||
|
||||
$table->bigIncrements('id');
|
||||
$table->string($morphPrefix . '_type')->nullable();
|
||||
$table->uuid($morphPrefix . '_id')->nullable();
|
||||
$table->string('event');
|
||||
$table->uuidMorphs('auditable');
|
||||
$table->text('old_values')->nullable();
|
||||
$table->text('new_values')->nullable();
|
||||
$table->text('url')->nullable();
|
||||
$table->ipAddress('ip_address')->nullable();
|
||||
$table->string('user_agent', 1023)->nullable();
|
||||
$table->string('tags')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index([$morphPrefix . '_id', $morphPrefix . '_type']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::connection(config('audit.drivers.database.connection', config('database.default')))->drop('audits');
|
||||
}
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
<?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_logins', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->uuid('user_id');
|
||||
$table->string('token');
|
||||
$table->timestamp('login')->nullable();
|
||||
$table->timestamp('logout')->nullable();
|
||||
$table->ipAddress('ip_address')->nullable();
|
||||
$table->string('user_agent', 1023)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_logins');
|
||||
}
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
<?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('analytics', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('type');
|
||||
$table->string('attribute');
|
||||
$table->text('useragent');
|
||||
$table->string('ip');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('analytics');
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('events', function (Blueprint $table) {
|
||||
$table->string('price')->default("");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->dropColumn('price');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('events', function (Blueprint $table) {
|
||||
$table->string('ages')->default("");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->dropColumn('ages');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('media')->whereNull('mime')->update(['mime' => '']);
|
||||
DB::table('media')->whereNull('permission')->update(['permission' => '']);
|
||||
|
||||
Schema::table('media', function (Blueprint $table) {
|
||||
$table->string('storage')->default("cdn");
|
||||
$table->string('description')->default("");
|
||||
$table->string('status')->default("");
|
||||
$table->string('dimensions')->default("");
|
||||
$table->text('variants');
|
||||
|
||||
$table->bigInteger('size')->default(0)->change();
|
||||
$table->string('permission')->default("")->nullable(false)->change();
|
||||
|
||||
$table->string('mime')->default("")->nullable(false)->change();
|
||||
});
|
||||
|
||||
Schema::table('media', function(Blueprint $table) {
|
||||
$table->renameColumn('mime', 'mime_type');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('media', function (Blueprint $table) {
|
||||
$table->bigInteger('size')->change();
|
||||
$table->string('mime_type')->nullable(true)->change();
|
||||
$table->string('permission')->nullable(true)->change();
|
||||
|
||||
$table->renameColumn('mime_type', 'mime');
|
||||
|
||||
$table->dropColumn('status');
|
||||
$table->dropColumn('dimensions');
|
||||
$table->dropColumn('variants');
|
||||
$table->dropColumn('description');
|
||||
$table->dropColumn('storage');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('users')->whereNull('phone')->update(['phone' => '']);
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('phone')->default("")->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('phone')->nullable(true)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('display_name')->default("");
|
||||
});
|
||||
|
||||
// Update existing rows with display_name
|
||||
DB::table('users')->select('id', 'username')->orderBy('id')->chunk(100, function ($users) {
|
||||
foreach ($users as $user) {
|
||||
DB::table('users')->where('id', $user->id)->update(['display_name' => $user->username]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('display_name');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::rename('posts', 'articles');
|
||||
|
||||
// Update permissions to use articles instead of posts
|
||||
DB::table('permissions')->select('id', 'permission')->where('permission', 'admin/posts')->update(['permission' => 'admin/articles']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::rename('articles', 'posts');
|
||||
|
||||
// Update permissions to use posts instead of articles
|
||||
DB::table('permissions')->select('id', 'permission')->where('permission', 'admin/articles')->update(['permission' => 'admin/posts']);
|
||||
}
|
||||
};
|
||||
@@ -1,72 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('analytics', function (Blueprint $table) {
|
||||
$table->bigInteger('session')->nullable(false);
|
||||
$table->string('attribute')->default('')->change();
|
||||
});
|
||||
|
||||
DB::table('analytics')
|
||||
->where('type', 'pageview')
|
||||
->update(['type' => 'apirequest']);
|
||||
|
||||
// Set first session
|
||||
$session = 0;
|
||||
|
||||
do {
|
||||
$rows = DB::table('analytics')
|
||||
->whereNull('session')
|
||||
->orWhere('session', 0)
|
||||
->orderBy('created_at', 'asc')
|
||||
->limit(1)
|
||||
->get();
|
||||
|
||||
if($rows->isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
$sessionRow = $rows->first();
|
||||
DB::table('analytics')->where('id', $sessionRow->id)->update(['session' => ++$session]);
|
||||
$lastSessionUpdate = $sessionRow->created_at;
|
||||
|
||||
do {
|
||||
$sameSessionRows = DB::table('analytics')
|
||||
->whereNull('session')
|
||||
->orWhere('session', 0)
|
||||
->where('useragent', $sessionRow->useragent)
|
||||
->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('30 minutes', strtotime($lastSessionUpdate))))
|
||||
->orderBy('created_at', 'desc')
|
||||
->get();
|
||||
|
||||
if($sameSessionRows->isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
$ids = $sameSessionRows->pluck('id')->toArray();
|
||||
DB::table('analytics')->whereIn('id', $ids)->update(['session' => $session]);
|
||||
$lastSessionUpdate = $sameSessionRows->first()->created_at;
|
||||
} while(true);
|
||||
} while(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('analytics', function (Blueprint $table) {
|
||||
$table->dropColumn('session');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('username');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('username')->unique();
|
||||
});
|
||||
|
||||
DB::table('users')->update(['username' => DB::raw('display_name')]);
|
||||
}
|
||||
};
|
||||
@@ -1,29 +0,0 @@
|
||||
<?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('shortlinks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code', 4)->unique();
|
||||
$table->string('url');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('shortlinks');
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('shortlinks', function (Blueprint $table) {
|
||||
$table->bigInteger('used')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('shortlinks', function (Blueprint $table) {
|
||||
$table->dropColumn('used');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->string('first_name')->default('')->change();
|
||||
$table->string('last_name')->default('')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('first_name')->nullable(false)->change();
|
||||
$table->string('last_name')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('events', function (Blueprint $table) {
|
||||
$table->string('location_url')->default('');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->dropColumn('location_url');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('attachments', function (Blueprint $table) {
|
||||
$table->boolean('private')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('attachments', function (Blueprint $table) {
|
||||
$table->dropColumn('private');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
<?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('event_users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->uuid('event_id');
|
||||
$table->uuid('user_id');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('event_id')->references('id')->on('events')->onDelete('cascade');
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('event_users');
|
||||
}
|
||||
};
|
||||
@@ -1,24 +0,0 @@
|
||||
<?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::rename('password_resets', 'password_reset_tokens');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::rename('password_reset_tokens', 'password_resets');
|
||||
}
|
||||
};
|
||||
@@ -1,116 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('analytics_sessions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->text('useragent');
|
||||
$table->string('ip');
|
||||
$table->timestamps();
|
||||
$table->timestamp('ended_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('analytics_requests', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->bigInteger('session_id')->unsigned();
|
||||
$table->string('type');
|
||||
$table->string('path');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('session_id')->references('id')->on('analytics_sessions')->onDelete('cascade');
|
||||
});
|
||||
|
||||
// Migrate old analytics table
|
||||
$analytics = DB::table('analytics')
|
||||
->select(
|
||||
'session',
|
||||
DB::raw('MAX(useragent) as useragent'),
|
||||
DB::raw('MAX(ip) as ip'),
|
||||
DB::raw('MIN(created_at) as created_at'),
|
||||
DB::raw('MIN(updated_at) as updated_at'))
|
||||
->groupBy('session')
|
||||
->get();
|
||||
foreach ($analytics as $sessionItem) {
|
||||
$ip = $sessionItem->ip;
|
||||
$useragent = $sessionItem->useragent;
|
||||
$session_id = $sessionItem->session;
|
||||
$created_at = $sessionItem->created_at;
|
||||
$updated_at = $sessionItem->updated_at;
|
||||
|
||||
// Create a new row in analytics_sessions
|
||||
$new_session_id = DB::table('analytics_sessions')->insertGetId([
|
||||
'id' => $session_id,
|
||||
'useragent' => $useragent,
|
||||
'ip' => $ip,
|
||||
'created_at' => $created_at,
|
||||
'updated_at' => $updated_at
|
||||
]);
|
||||
|
||||
$requests = DB::table('analytics')->where('session', $session_id)->select('type', 'attribute', 'created_at', 'updated_at')->get();
|
||||
$ended_at = $sessionItem->created_at;
|
||||
|
||||
foreach($requests as $requestItem) {
|
||||
if($ended_at < $requestItem->created_at) {
|
||||
$ended_at = $requestItem->created_at;
|
||||
}
|
||||
|
||||
DB::table('analytics_requests')->insert([
|
||||
'session_id' => $new_session_id,
|
||||
'type' => $requestItem->type,
|
||||
'path' => $requestItem->attribute,
|
||||
'created_at' => $requestItem->created_at,
|
||||
'updated_at' => $requestItem->updated_at,
|
||||
]);
|
||||
}
|
||||
|
||||
DB::table('analytics_sessions')->where('id', $new_session_id)->update(['ended_at' => $ended_at]);
|
||||
}
|
||||
|
||||
Schema::dropIfExists('analytics');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::create('analytics', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->bigInteger('session')->nullable(false);
|
||||
$table->string('type');
|
||||
$table->string('attribute')->default('');
|
||||
$table->text('useragent');
|
||||
$table->string('ip');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
$sessions = DB::table('analytics_sessions')->get();
|
||||
foreach ($sessions as $session) {
|
||||
$requests = DB::table('analytics_requests')->where('session_id', $session->id)->get();
|
||||
foreach($requests as $request) {
|
||||
DB::table('analytics')->insert([
|
||||
'session' => $session->id,
|
||||
'type' => $request->type,
|
||||
'attribute' => $request->path,
|
||||
'ip' => $session->ip,
|
||||
'useragent' => $session->useragent,
|
||||
'created_at' => $request->created_at,
|
||||
'updated_at' => $request->updated_at,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Schema::dropIfExists('analytics_requests');
|
||||
Schema::dropIfExists('analytics_sessions');
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('events', function (Blueprint $table) {
|
||||
$table->timestamp('open_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->dropColumn('open_at');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?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('attachments', function (Blueprint $table) {
|
||||
$table->renameColumn('attachable_type', 'addendum_type');
|
||||
});
|
||||
|
||||
Schema::table('attachments', function (Blueprint $table) {
|
||||
$table->renameColumn('attachable_id', 'addendum_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('attachments', function (Blueprint $table) {
|
||||
$table->renameColumn('addendum_type', 'attachable_type');
|
||||
});
|
||||
|
||||
Schema::table('attachments', function (Blueprint $table) {
|
||||
$table->renameColumn('addendum_id', 'attachable_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('analytics_sessions', function (Blueprint $table) {
|
||||
$table->text('useragent')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('analytics_sessions', function (Blueprint $table) {
|
||||
$table->text('useragent')->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('media', function (Blueprint $table) {
|
||||
$table->string('thumbnail')->default('');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('media', function (Blueprint $table) {
|
||||
$table->dropColumn('thumbnail');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?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('media_jobs', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->timestamps();
|
||||
$table->uuid('user_id')->nullable();
|
||||
$table->uuid('media_id')->nullable(); // Add a foreign key for the media model
|
||||
$table->string('status');
|
||||
$table->string('status_text');
|
||||
$table->text('data');
|
||||
$table->integer('progress')->default(0); // Add a column for job progress
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('media_id')->references('id')->on('media')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('media_jobs');
|
||||
}
|
||||
};
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// Delete rows where the status is not 'OK'
|
||||
DB::table('media')->where('status', '<>', 'OK')->delete();
|
||||
|
||||
// Remove the 'status' column from the 'media' table
|
||||
Schema::table('media', function (Blueprint $table) {
|
||||
$table->dropColumn('status');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Add the 'status' column back with a default value of an empty string
|
||||
Schema::table('media', function (Blueprint $table) {
|
||||
$table->string('status')->default('');
|
||||
});
|
||||
|
||||
// Update the 'status' column of all rows to 'OK'
|
||||
DB::table('media')->update(['status' => 'OK']);
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('analytics_requests', function (Blueprint $table) {
|
||||
$table->text('path')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('analytics_requests', function (Blueprint $table) {
|
||||
$table->string('path')->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?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('events', function (Blueprint $table) {
|
||||
$table->text('location_url')->change();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->string('location_url')->change();
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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('media_jobs', function (Blueprint $table) {
|
||||
$table->integer('progress_max')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('media_jobs', function (Blueprint $table) {
|
||||
$table->dropColumn('progress_max');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,44 +0,0 @@
|
||||
<?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('media', function (Blueprint $table) {
|
||||
$table->renameColumn('permission', 'security_data');
|
||||
});
|
||||
|
||||
Schema::table('media', function (Blueprint $table) {
|
||||
$table->string('security_type')->default("");
|
||||
});
|
||||
|
||||
DB::table('media')
|
||||
->where('security_data', '!=', '')
|
||||
->update(['security_type' => 'permission']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
DB::table('media')
|
||||
->where('security_type', '!=', 'permission')
|
||||
->update(['security_data' => '']);
|
||||
|
||||
Schema::table('media', function (Blueprint $table) {
|
||||
$table->renameColumn('security_data', 'permission');
|
||||
});
|
||||
|
||||
Schema::table('media', function (Blueprint $table) {
|
||||
$table->dropColumn('security_type');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -12,13 +12,13 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('media', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->uuid('user_id');
|
||||
$table->string('name')->primary();
|
||||
$table->string('title');
|
||||
$table->string('name');
|
||||
$table->string('mime');
|
||||
$table->string('permission')->nullable();
|
||||
$table->string('hash', 64)->nullable();
|
||||
$table->string('mime_type');
|
||||
$table->bigInteger('size');
|
||||
$table->json('variants')->nullable();
|
||||
$table->foreignUuid('user_id')->constrained();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
@@ -12,14 +12,16 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('posts', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('slug', 255)->unique();
|
||||
$table->string('title', 255);
|
||||
$table->timestamp('publish_at')->nullable()->useCurrent();
|
||||
$table->uuid('user_id');
|
||||
$table->uuid('hero');
|
||||
$table->text('content');
|
||||
$table->string('id')->primary();
|
||||
$table->string('hero_media_name');
|
||||
$table->string('status')->default('draft');
|
||||
$table->timestamp('published_at')->nullable();
|
||||
$table->string('title');
|
||||
$table->longText('content');
|
||||
$table->foreignUuid('user_id')->constrained('users');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('hero_media_name')->references('name')->on('media');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,14 +11,13 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('galleries', function (Blueprint $table) {
|
||||
Schema::create('locations', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->uuid('media_id');
|
||||
$table->uuidMorphs('addendum');
|
||||
$table->string('name');
|
||||
$table->string('address')->nullable();
|
||||
$table->string('address_url')->nullable();
|
||||
$table->string('url')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('media_id')->references('id')->on('media')->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +26,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('galleries');
|
||||
Schema::dropIfExists('locations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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('workshops', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('title');
|
||||
$table->string('hero_media_name');
|
||||
$table->text('content');
|
||||
$table->timestamp('starts_at');
|
||||
$table->timestamp('ends_at');
|
||||
$table->timestamp('publish_at');
|
||||
$table->timestamp('closes_at');
|
||||
$table->string('status')->default('draft');
|
||||
$table->string('price')->nullable();
|
||||
$table->string('ages')->nullable();
|
||||
$table->string('registration')->default('none');
|
||||
$table->string('registration_data')->nullable();
|
||||
$table->foreignUuid('location_id')->nullable()->constrained('locations');
|
||||
$table->foreignUuid('user_id')->constrained('users');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('hero_media_name')->references('name')->on('media');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('workshops');
|
||||
}
|
||||
};
|
||||
@@ -11,13 +11,13 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('attachments', function (Blueprint $table) {
|
||||
Schema::create('tickets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->uuid('media_id');
|
||||
$table->uuidMorphs('attachable');
|
||||
$table->unsignedInteger('status')->default(0);
|
||||
$table->foreignUuid('user_id')->constrained();
|
||||
$table->string('workshop_id');
|
||||
$table->foreign('workshop_id')->references('id')->on('workshops');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('media_id')->references('id')->on('media')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('attachments');
|
||||
Schema::dropIfExists('tickets');
|
||||
}
|
||||
};
|
||||
@@ -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.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('mediables', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('media_name');
|
||||
$table->string('mediable_id');
|
||||
$table->string('mediable_type');
|
||||
$table->index(['mediable_id', 'mediable_type'], 'media_name');
|
||||
$table->string('collection')->nullable();
|
||||
$table->timestamps();
|
||||
$table->foreign('media_name')->references('name')->on('media')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mediables');
|
||||
}
|
||||
};
|
||||
@@ -11,10 +11,10 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('subscriptions', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
Schema::create('email_subscriptions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('email');
|
||||
$table->timestamp('confirmed_at')->nullable();
|
||||
$table->text('confirmed')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
@@ -24,6 +24,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('subscriptions');
|
||||
Schema::dropIfExists('email_subscriptions');
|
||||
}
|
||||
};
|
||||
@@ -11,7 +11,13 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::dropIfExists('subscriptions');
|
||||
Schema::create('email_updates', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignUuid('user_id')->constrained()->onDelete('cascade');
|
||||
$table->string('email');
|
||||
$table->string('token')->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -19,11 +25,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::create('subscriptions', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('email');
|
||||
$table->timestamp('confirmed_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
Schema::dropIfExists('email_updates');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user