Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relate_form_submissions_by_handle migration runs every composer install or composer require and causes issues with deployment #333

Closed
eiiot opened this issue Aug 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@eiiot
Copy link

eiiot commented Aug 7, 2024

Bug description

Whenever I install (or uninstall) a package with composer, eloquent runs the RelateFormSubmissionsByHandle and creates that migration. I'm not using eloquent to manage forms, just entries and assets, so I don't think this is expected behavior? This also causes issues when I try to deploy versions of Statamic with the migration:

...continues above
83 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Restarting FPM...
Warning: The unit file, source configuration file or drop-ins of php8.3-fpm.service changed on disk. Run 'systemctl daemon-reload' to reload units.

   INFO  Running migrations.  

  2024_08_06_143940_relate_form_submissions_by_handle ............ 7.95ms FAIL

In Connection.php line 813:
                                                                               
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'statamic.form_su  
  bmissions' doesn't exist (Connection: mysql, SQL: alter table `form_submiss  
  ions` add `form` varchar(30) null after `id`)                                
                                                                               

In Connection.php line 571:
                                                                               
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'statamic.form_su  
  bmissions' doesn't exist                                                     

If I had to guess, this has something to do with #323 but I haven't been using eloquent for that long, so it's still a guess.

How to reproduce

  1. Install eloquent driver and configure it to only use assets & entries
  2. Install some package using composer install or php please install (this works fairly consistently with php please install:collaboration).

Logs

~/Herd/crimson composer require "statamic/eloquent-driver 4.12.2"
./composer.json has been updated
Running composer update statamic/eloquent-driver
> Statamic\Console\Composer\Scripts::preUpdateCmd
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading statamic/eloquent-driver (v4.12.0 => v4.12.2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Downloading statamic/eloquent-driver (v4.12.2)
  - Upgrading statamic/eloquent-driver (v4.12.0 => v4.12.2): Extracting archive
Generating optimized autoload files
Class App\View\Components\Header located in ./app/View/Components/CoverHeader.php does not comply with psr-4 autoloading standard (rule: App\ => ./app). Skipping.
Class App\View\Components\Header located in ./app/View/Components/SplitHeader.php does not comply with psr-4 autoloading standard (rule: App\ => ./app). Skipping.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   INFO  Discovering packages.  

  ajthinking/archetype ............................................................................ DONE
  barryvdh/laravel-debugbar ....................................................................... DONE
  blade-ui-kit/blade-icons ........................................................................ DONE
  codeat3/blade-fluentui-system-icons ............................................................. DONE
  intervention/image .............................................................................. DONE
  jason-guru/laravel-make-repository .............................................................. DONE
  jgrossi/corcel .................................................................................. DONE
  laravel/reverb .................................................................................. DONE
  laravel/sail .................................................................................... DONE
  laravel/tinker .................................................................................. DONE
  nesbot/carbon ................................................................................... DONE
  nunomaduro/collision ............................................................................ DONE
  nunomaduro/termwind ............................................................................. DONE
  rebing/graphql-laravel .......................................................................... DONE
  spatie/laravel-ignition ......................................................................... DONE
  statamic/cms .................................................................................... DONE
  statamic/eloquent-driver ........................................................................ DONE
  van-ons/laraberg ................................................................................ DONE
  wilderborn/partyline ............................................................................ DONE

> @php artisan statamic:install --ansi

   INFO  Discovering addons.  

  Discovered Addon: statamic/eloquent-driver ...................................................... DONE

   INFO  Publishing [statamic] assets.  

  File [config/statamic/antlers.php] already exists ............................................ SKIPPED  
  File [config/statamic/api.php] already exists ................................................ SKIPPED  
  File [config/statamic/assets.php] already exists ............................................. SKIPPED  
  File [config/statamic/autosave.php] already exists ........................................... SKIPPED  
  File [config/statamic/cp.php] already exists ................................................. SKIPPED  
  File [config/statamic/editions.php] already exists ........................................... SKIPPED  
  File [config/statamic/forms.php] already exists .............................................. SKIPPED  
  File [config/statamic/git.php] already exists ................................................ SKIPPED  
  File [config/statamic/graphql.php] already exists ............................................ SKIPPED  
  File [config/statamic/live_preview.php] already exists ....................................... SKIPPED  
  File [config/statamic/markdown.php] already exists ........................................... SKIPPED  
  File [config/statamic/oauth.php] already exists .............................................. SKIPPED  
  File [config/statamic/protect.php] already exists ............................................ SKIPPED  
  File [config/statamic/revisions.php] already exists .......................................... SKIPPED  
  File [config/statamic/routes.php] already exists ............................................. SKIPPED  
  File [config/statamic/search.php] already exists ............................................. SKIPPED  
  File [config/statamic/static_caching.php] already exists ..................................... SKIPPED  
  File [config/statamic/stache.php] already exists ............................................. SKIPPED  
  File [config/statamic/system.php] already exists ............................................. SKIPPED  
  File [config/statamic/users.php] already exists .............................................. SKIPPED  
  Copying directory [vendor/statamic/cms/resources/users] to [resources/users] .................... DONE
  File [please] already exists ................................................................. SKIPPED  

   INFO  Publishing [statamic-cp] assets.  

  Copying directory [vendor/statamic/cms/resources/dist] to [public/vendor/statamic/cp] ........... DONE

   INFO  Publishing [statamic-frontend] assets.  

  Copying directory [vendor/statamic/cms/resources/dist-frontend] to [public/vendor/statamic/frontend]  DONE

   INFO  Compiled views cleared successfully.  

   INFO  Application cache cleared successfully.  

Running update script [Statamic\Eloquent\Updates\RelateFormSubmissionsByHandle]
Migration created
Remember to run `php artisan migrate` to apply it to your database.
112 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force

   INFO  No publishable resources for tag [laravel-assets].  

No security vulnerability advisories found.

Environment

Environment
Application Name: Statamic
Laravel Version: 11.7.0
PHP Version: 8.3.6
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: crimson.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: null
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 2
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.19.0 PRO

Statamic Addons
statamic/collaboration: 1.0.0
statamic/eloquent-driver: 4.12.2

Statamic Eloquent Driver
Asset Containers: file
Assets: eloquent
Blueprints: file
Collection Trees: file
Collections: file
Entries: eloquent
Forms: file
Global Sets: file
Global Variables: file
Navigation Trees: file
Navigations: file
Revisions: file
Sites: file
Taxonomies: file
Terms: file
Tokens: file

Additional details

No response

@eiiot eiiot added the bug Something isn't working label Aug 7, 2024
@ryanmitchell
Copy link
Contributor

Thanks, I've fixed this in #334 and its released in v4.12.3

@eiiot
Copy link
Author

eiiot commented Aug 7, 2024

Wow, that was fast. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants