Shrey
Shrey

Reputation: 146

Update Enum Options using Laravel Migration

If the enums are modified in the enums.php file, how would I change the migration?

I have my migration file like the following-

    public function up()
    {
        Schema::create('increase_pond_height', function (Blueprint $table) {
            $table->increments('id');
            $table->float('height', 8, 2);
            $table->enum('purpose', Config::get('enums.increase_pond_height_purposes'));
            $table->string('comments', 500)->nullable();
            $table->timestamps();
        });
    }

I have the enum.php in Config like the following-

<?php

return [
    'increase_pond_height_purposes' => ['innoculum', 'harvest', 'media_addition']
];

Upvotes: 0

Views: 179

Answers (1)

Foued MOUSSI
Foued MOUSSI

Reputation: 4813

Short answer : you can't

Each time you edit your enum.php config file Manually you must add a new migration to alter your increase_pond_height table

Upvotes: 1

Related Questions