Issues with migration

I just pulled a full october cms installation from a repo and I’m trying to preform migration but it keeps giving me this error. How can I resolve it, in the PHP my admin the field isn’t there, I have tried to create it manually then it complains that the column already exists. Im at a complete loss here, the installation worked fine before the submission to git. On the submit we added absolutely everything besides the MySQL database.

The migration file that’s giving the issues

<?php namespace Cunami\PhoneCatalog\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;

class BuilderTableUpdateCunamiPhonecatalog8 extends Migration
{
    public function up()
    {
        Schema::table('cunami_phonecatalog_', function($table)
        {
            $table->integer('index_id')->unsigned();
            $table->integer('number_id')->nullable()->unsigned()->default(null)->comment(null)->change();
        });
    }
    
    public function down()
    {
        Schema::table('cunami_phonecatalog_', function($table)
        {
            $table->dropColumn('index_id');
            $table->bigInteger('number_id')->nullable()->unsigned(false)->default(null)->comment(null)->change();
        });
    }
}

If you run the migration and see "There is no column with name “number_id” on table “cunami_phonecatalog_”,

you should be able to add a column with name “number_id” in the table “cunami_phonecatalog_” and then rerun the migration

So you mean right here in the create migration file?

but that’s not your plugin? or it is?

if it is, you could add it there if it’s missing and redo all the migrations.

if not, add it manually in your db?

Its my custom plugin but the issue is that if I add this column manually to the db it complains that the field already exists.

I tried to add it in that file but it is still showing the same error. That it cannot be found on the same PHP file.

- v1.0.26:  Migration "builder_table_update_cunami_phonecatalog__8.php" failed

In ColumnDoesNotExist.php line 16:
                                                                             
  There is no column with name "number_id" on table "cunami_phonecatalog_". 

So if you go in the table “cunami_phonecatalog_”, you see the field “number_id” ?

In php my admin it doesnt exist.
In the builder_table_create_cunami_phonecatalog__3.php it has its first mention Originally.

If you don’t see it in PhpMyAdmin, in your table, then try to create it?

Pro tip: Try running --skip-errors to push this through.

php artisan october:migrate --skip-errors

Although, you should really inspect the migrations to resolve the error, this will at least allow you to keep moving.

Thankyou for the tip it turned out it was a depricated plugin, but for further use this might be useful.

1 Like