getTable('activity'); if (!$table->hasColumn('object_type')) { $table->addColumn('object_type', Types::STRING, [ 'notnull' => false, 'length' => 255, ]); $table->addColumn('object_id', Types::BIGINT, [ 'notnull' => true, 'length' => 20, 'default' => 0, ]); } if (!$table->hasIndex('activity_object')) { $table->addIndex(['object_type', 'object_id'], 'activity_object'); } return $schema; } }