6

I'm using Laravel Cashier package.

I've added below line AppServiceProvider.php > boot method

 Cashier::ignoreMigrations();

I've create my own migration i.e: create_subscriptions_table and create_subscription_items_table

When I run php artisan migrate command then getting below error:

   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') 

I get this error because migration 2019_05_03_000002_create_subscriptions_table is in vendor folder.

I want run my own migration not from vendor so is there any solution to fix this issue ?

Milan
  • 631
  • 1
  • 5
  • 21

1 Answers1

4

I've fixed issue by following steps:

  1. First I run command php artisan vendor:publish --tag="cashier-migrations". It will create a new migrations and I've removed code of up() and down() method from new migrations.

By doing this we can keep our override migration of Cashier package.

  1. Run command php artisan migrate
Milan
  • 631
  • 1
  • 5
  • 21