Add a dated file to your module's Migrations/ returning an anonymous class extending Migration with up() and down(). Run php tools/convoro migrate. Make it re-runnable — check before you alter.

Files are named YYYY_MM_DD_NNNNNN_what_it_does.php and return an anonymous class:

return new class extends Migration {
    public function up(): void
    {
        $this->schema->create('examples', function ($bp) {
            $bp->id();
            $bp->string('title', 200);
            $bp->text('body')->nullable();
            $bp->bigInt('user_id', true)->nullable();
            $bp->index('user_id');
            $bp->timestamps();
            $bp->unique('slug');
        });
    }

    public function down(): void
    {
        $this->schema->drop('examples');
    }
};

To change an existing table use $this->schema->alter(), and guard it with hasColumn() so running it twice is harmless.

🚨 Never alter a table belonging to a module you do not depend on. It fails outright on a site where that module is not installed. If you need to associate your data with another application's, use a join table your own module owns — that is exactly what Clubs does.

🚨 Backtick reserved words. groups and key are both real table and column names here.

Sign in to say whether this helped.