Skip to content

Conversation

@ryanmitchell
Copy link
Contributor

This PR updates the form_submissions update migration to check it needs to be run. It also ensures we only drop the foreign key if it exists.

Closes: #323
Fixes: #285 (comment)

@DanielDarrenJones
Copy link

@ryanmitchell I seem to be getting an issue when running this:

   INFO  Running migrations.  

  2024_05_15_100000_modify_form_submissions_id ........................................................................................... 25ms DONE
  2024_06_11_183314_drop_status_on_entries ................................................................................................ 5ms DONE
  2024_06_11_183314_relate_form_submissions_by_handle .................................................................................... 13ms FAIL

   Error 

  Class "Doctrine\DBAL\Driver\AbstractMySQLDriver" not found

  at vendor/laravel/framework/src/Illuminate/Database/PDO/MySqlDriver.php:8
      4▕ 
      5▕ use Doctrine\DBAL\Driver\AbstractMySQLDriver;
      6▕ use Illuminate\Database\PDO\Concerns\ConnectsToDatabase;
      7▕ 
  ➜   8▕ class MySqlDriver extends AbstractMySQLDriver
      9▕ {
     10▕     use ConnectsToDatabase;
     11▕ 
     12▕     /**

      +5 vendor frames 

  6   database/migrations/2024_06_11_183314_relate_form_submissions_by_handle.php:62
      Illuminate\Database\Connection::getDoctrineSchemaManager()

  7   database/migrations/2024_06_11_183314_relate_form_submissions_by_handle.php:31
      Statamic\Eloquent\Database\BaseMigration@anonymous\/Users/danieljones/Dev/pelorus-travel/database/migrations/2024_06_11_183314_relate_form_submissions_by_handle.php:9$1fb::listTableForeignKeys("form_submissions")

However, if I run the migration a second time after it succeeds:

   INFO  Running migrations.  

  2024_06_11_183314_relate_form_submissions_by_handle  3ms DONE

@ryanmitchell
Copy link
Contributor Author

I guess you need doctrine/dbal installed for it to work.
Back to the drawing board.

@ryanmitchell
Copy link
Contributor Author

@DanielDarrenJones this work any better? 0d251c7

@DanielDarrenJones
Copy link

@ryanmitchell that seems to run fine against my project! :)

@ryanmitchell
Copy link
Contributor Author

@DanielDarrenJones can I just check you had cleared the previous migration entry from your migrations table before testing?

@DanielDarrenJones
Copy link

@DanielDarrenJones can I just check you had cleared the previous migration entry from your migrations table before testing?

Yeah I ran from a backup of our live statamic 4 project (we were just in the process of deploying v5 so this was perfect timing)

@ryanmitchell
Copy link
Contributor Author

@DanielDarrenJones awesome thanks for confirming

@ryanmitchell ryanmitchell merged commit 5bb10fa into statamic:master Jul 18, 2024
@ryanmitchell ryanmitchell deleted the fix/check-form-exists-in-migration branch July 18, 2024 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

relate_form_submissions_by_handle migration causing issues

2 participants