Can't you remove the file if not needed. https://forge.laravel.com/docs/1.0/sites/deployments.html#deploy-script
Forge deployment fails on migration
My deployment fails with the message SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'sessions' already exists
i.e. it's trying to run migrations when there should be nothing to migrate.
In local development running ./vendor/bin/sail php artisan migrate gives the expected response of nothing to migrate
I've tried deleting the site from Forge and redeploying, which works the first time but then fails again. Is there anything I can do to let Forge know there's nothing to migrate?
I managed to fix the problem, so just in case anyone else gets into this muddle here's the problem and solution:
I'd absentmindedly made some changes directly to the database (I come from a MS Access background, IKR), so the migration pattern was disrupted somehow.
On my local machine artisan migrate:status showed all migrations as Ran. On the remote machine only the boilerplate migrations showed yes, with all mine showing no, even though all the tables were present in the production database. This of course resulted in a Table already exists error when the Forge deploy script tried to run migrate.
I solved the problem by deleting all the tables in the production database, then running migrate on the remote server via the command line. Restoring the database from a backup (via TablePlus) unfortunately also restored the problem, so I extracted just the INSERT statements from the database dump and imported them.
Now the site is back up & running and I can make more migrations :D
Please or to participate in this conversation.