Last active
September 2, 2023 04:53
-
-
Save Swader/a892bd87553036142aa0073c2ef0d4f5 to your computer and use it in GitHub Desktop.
Cursor Migration Output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateEditionSectionsTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('edition_sections', function (Blueprint $table) { | |
$table->unsignedBigInteger('edition'); | |
$table->unsignedBigInteger('section'); | |
$table->mediumText('frontmatter')->nullable(); | |
$table->mediumText('hz_pills_filled')->nullable(); | |
$table->id(); | |
$table->foreign('edition')->references('id')->on('editions')->onDelete('cascade')->onUpdate('cascade'); | |
$table->foreign('section')->references('id')->on('sections')->onDelete('cascade')->onUpdate('cascade'); | |
$table->timestamps(); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('edition_sections'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateEditionsTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('editions', function (Blueprint $table) { | |
$table->id(); | |
$table->unsignedBigInteger('newsletter'); | |
$table->string('subject', 150); | |
$table->foreign('newsletter')->references('id')->on('newsletters')->onDelete('restrict')->onUpdate('restrict'); | |
$table->timestamps(); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('editions'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateLinksTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('links', function (Blueprint $table) { | |
$table->id(); | |
$table->string('url', 255); | |
$table->string('title', 255); | |
$table->mediumText('summary')->nullable(); | |
$table->unsignedBigInteger('sec_ed')->nullable(); | |
$table->foreign('sec_ed')->references('id')->on('edition_sections')->onDelete('no action')->onUpdate('no action'); | |
$table->timestamps(); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('links'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateFailedJobsTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('failed_jobs', function (Blueprint $table) { | |
$table->id(); | |
$table->string('uuid', 255)->unique(); | |
$table->text('connection'); | |
$table->text('queue'); | |
$table->longText('payload'); | |
$table->longText('exception'); | |
$table->timestamp('failed_at')->useCurrent(); | |
$table->timestamps(); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('failed_jobs'); | |
} | |
} | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreatePasswordResetTokensTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('password_reset_tokens', function (Blueprint $table) { | |
$table->string('email', 255)->primary(); | |
$table->string('token', 255); | |
$table->timestamp('created_at')->nullable(); | |
$table->timestamps(); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('password_reset_tokens'); | |
} | |
} | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreatePersonalAccessTokensTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('personal_access_tokens', function (Blueprint $table) { | |
$table->id(); | |
$table->string('tokenable_type', 255); | |
$table->unsignedBigInteger('tokenable_id'); | |
$table->string('name', 255); | |
$table->string('token', 64)->unique(); | |
$table->text('abilities')->nullable(); | |
$table->timestamp('last_used_at')->nullable(); | |
$table->timestamp('expires_at')->nullable(); | |
$table->timestamps(); | |
$table->index(['tokenable_type', 'tokenable_id']); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('personal_access_tokens'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreatePlansTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('plans', function (Blueprint $table) { | |
$table->id(); | |
$table->string('name', 45); | |
$table->string('slug', 45)->unique(); | |
$table->mediumText('description')->nullable(); | |
$table->unsignedInteger('price_month'); | |
$table->unsignedInteger('price_nl'); | |
$table->unsignedInteger('price_per_user'); | |
$table->unsignedInteger('annual_discount_percent'); | |
$table->timestamps(); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('plans'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateRolesTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('roles', function (Blueprint $table) { | |
$table->id(); | |
$table->string('title', 45)->unique(); | |
$table->string('slug', 45)->unique(); | |
$table->mediumText('description')->nullable(); | |
$table->timestamps(); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('roles'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateSectionsTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('sections', function (Blueprint $table) { | |
$table->id(); | |
$table->string('heading', 45); | |
$table->mediumText('frontmatter')->nullable(); | |
$table->json('style_options')->nullable(); | |
$table->unsignedBigInteger('newsletter'); | |
$table->json('hz_pills')->nullable(); | |
$table->foreign('newsletter')->references('id')->on('newsletters')->onDelete('cascade')->onUpdate('cascade'); | |
$table->timestamps(); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('sections'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class ModifyUsersTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::table('users', function (Blueprint $table) { | |
$table->unsignedBigInteger('plan')->default(0)->after('created_at'); | |
$table->foreign('plan')->references('id')->on('plans')->onDelete('no action')->onUpdate('no action'); | |
}); | |
} | |
public function down() | |
{ | |
Schema::table('users', function (Blueprint $table) { | |
$table->dropForeign(['plan']); | |
$table->dropColumn('plan'); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment