【发布时间】:2021-08-28 05:37:22
【问题描述】:
我正在使用Laravel Cashier 包。
我在 AppServiceProvider.php 下面添加了 > 启动方法
Cashier::ignoreMigrations();
我已经创建了自己的迁移,即:create_subscriptions_table 和 create_subscription_items_table
当我运行php artisan migrate 命令时出现以下错误:
Migrating: 2019_05_03_000002_create_subscriptions_table
Illuminate\Database\QueryException
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'subscriptions' already exists (SQL: create table `subscriptions` (`id` bigint unsigned not null auto_increment primary key, `user_id` bigint unsigned not null, `name` varchar(191) not null, `stripe_id` varchar(191) not null, `stripe_status` varchar(191) not null, `stripe_plan` varchar(191) null, `quantity` int null, `trial_ends_at` timestamp null, `ends_at` timestamp null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
我收到此错误是因为迁移 2019_05_03_000002_create_subscriptions_table 位于供应商文件夹中。
我想运行我自己的迁移,而不是从供应商那里迁移,那么有什么解决方案可以解决这个问题吗?
【问题讨论】:
-
在 AppServiceProvider 中添加
Cashier::ignoreMigrations();后,您删除了所有 tabled 并重新运行迁移?还是直接运行php artisan migrate? -
我已经运行了 php artisan migrate 命令
标签: php migration laravel-8 laravel-cashier