<?php

namespace olivestudio\olivemenus\migrations;

use craft\db\Migration;

/**
 * Migration: Add site_id field to olivemenus table migration.
 * @since 1.1.7
 */
class m200228_124859_olivemenus_addSiteIdFieldToMenusTable extends Migration
{
	/**
	 * @inheritdoc
	 */
	public function safeUp()
	{
		// Place migration code here...
		
		if (!$this->db->columnExists('{{%olivemenus}}', 'site_id')) {
			$this->addColumn('{{%olivemenus}}', 'site_id', $this->integer(11)->after('handle'));
		}
	}

	/**
	 * @inheritdoc
	 */
	public function safeDown()
	{
	    $this->dropColumn('{{%olivemenus}}', 'site_id');
	}
}

<?php

namespace olivestudio\olivemenus\migrations;

use Craft;
use craft\db\Migration;

/**
 * Migration: Add site_id field to olivemenus table migration.
 * @since 1.1.7
 */
class m200228_124859_olivemenus_addSiteIdFieldToMenusTable extends Migration
{
	/**
	 * @inheritdoc
	 */
	public function safeUp()
	{
		if (!$this->db->columnExists('{{%olivemenus}}', 'site_id')) {
			$this->addColumn('{{%olivemenus}}', 'site_id', $this->integer(11)->after('handle'));
			$this->update('{{%olivemenus}}', ['site_id' => Craft::$app->sites->primarySite->id]);
		}
	}

	/**
	 * @inheritdoc
	 */
	public function safeDown()
	{
	    $this->dropColumn('{{%olivemenus}}', 'site_id');
	}
}

Set primary site ID as default site ID for existing menus
Set primary site ID as default site ID for existing menus
