laravel / cashier-stripe

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.
https://laravel.com/docs/billing
MIT License
2.37k stars 667 forks source link

Migrations do not create foreign key in "subscription_items" to "subscriptions" table #1666

Closed giacomomasseron closed 5 months ago

giacomomasseron commented 5 months ago

Cashier Stripe Version

15.3.0

Laravel Version

10.47

PHP Version

8.1.2

Database Driver & Version

MySQL 8.0.30 installed with Laragon on Windows

Description

The default cashier migrations do not create foreign key in "subscription_items" to "subscriptions" table.

The problem seems here, file 2019_05_03_000003_create_subscription_items_table.php:

$table->foreignId('subscription_id');

Steps To Reproduce

composer create-project laravel/laravel laravel-cashier
cd .\laravel-cashier\
composer require laravel/cashier
php artisan vendor:publish --tag="cashier-migrations"
php artisan migrate
driesvints commented 5 months ago

This method doesn't creates a foreign key. It's name might be a bit misleading but it just creates an unsigned column: https://laravel.com/docs/11.x/migrations#column-method-foreignId