🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
42 lines
1.4 KiB
Plaintext
Executable File
42 lines
1.4 KiB
Plaintext
Executable File
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* IMPORTANT: Use raw MySQL queries for clarity and auditability
|
|
* ✅ DB::statement("ALTER TABLE users ADD COLUMN age BIGINT")
|
|
* ❌ Schema::table() with Blueprint
|
|
*
|
|
* REQUIRED: ALL tables MUST have: id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY
|
|
* No exceptions - every table needs this exact ID column (SIGNED for easier migrations)
|
|
*
|
|
* Integer types: Use BIGINT for all integers, TINYINT(1) for booleans only
|
|
* Never use unsigned - all integers should be signed
|
|
*
|
|
* Migrations must be self-contained - no Model/Service references
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
// Examples:
|
|
// DB::statement("CREATE TABLE example (
|
|
// id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
// name VARCHAR(255)
|
|
// )");
|
|
// DB::statement("ALTER TABLE users ADD COLUMN name VARCHAR(255) NOT NULL");
|
|
// DB::statement("UPDATE posts SET published = 1 WHERE created_at < '2024-01-01'");
|
|
}
|
|
|
|
/**
|
|
* down() method is prohibited in RSpade framework
|
|
* Migrations should only move forward, never backward
|
|
* You may remove this comment as soon as you see it and understand.
|
|
*/
|
|
};
|