laravel-shopify icon indicating copy to clipboard operation
laravel-shopify copied to clipboard

Migration error

Open CHEWX opened this issue 2 years ago • 1 comments

For bug reporting only! If you're posting a feature request or discussion, please ignore.

Expected Behavior

Running php artisan migrate to successfully run.

Current Behavior

Hitting an error, only with this package required, I removed and test and it successfully worked.

Failure Information

Please help provide information about the failure if this is a bug.

Migrating: 2020_01_29_231006_create_charges_table

   Illuminate\Database\QueryException

  SQLSTATE[42S01]: Base table or view already exists: 1050 Unknown error 1050 (SQL: create table `charges` (`id` int unsigned not null auto_increment primary key, `charge_id` bigint not null, `test` tinyint(1) not null default '0', `status` varchar(255) null, `name` varchar(255) null, `terms` varchar(255) null, `type` varchar(255) not null, `price` decimal(8, 2) not null, `capped_amount` decimal(8, 2) null, `trial_days` int null, `billing_on` timestamp null, `activated_on` timestamp null, `trial_ends_on` timestamp null, `cancelled_on` timestamp null, `expires_on` timestamp null, `plan_id` int unsigned null, `description` varchar(255) null, `reference_charge` bigint null, `created_at` timestamp null, `updated_at` timestamp null, `deleted_at` timestamp null, `user_id` bigint unsigned not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. composer require osiset/laravel-shopify
  2. php artisan migrate

CHEWX avatar Jun 01 '22 14:06 CHEWX

If I delete the charges table and re-run.

Migrating: 2020_01_29_231006_create_charges_table

   Illuminate\Database\QueryException

  SQLSTATE[HY000]: General error: 1215 Unknown error 1215 (SQL: alter table `charges` add constraint `charges_user_id_foreign` foreign key (`user_id`) references `users` (`id`) on delete cascade)

CHEWX avatar Jun 01 '22 14:06 CHEWX

Have you set up your database and are you using mysql?

Deleting the table and trying to rerun will cause the error, as there will be a foreign key on users already from the migration and will try to add it again.

I would rollback and start again, rather than delete directly as you will break the migration intended purpose.

Kyon147 avatar Aug 26 '22 08:08 Kyon147

Closing as the ticket is stale. Re-open if issue persists.

Kyon147 avatar Sep 07 '22 07:09 Kyon147