cashier-stripe: Error in migration when using postgres.

  • Cashier Version: v10.0.0
  • Laravel Version: v5.8.32
  • PHP Version: 7.3.8
  • Database Driver & Version: postgres 10

Description:

Then migration 2019_05_03_000001_create_customer_columns gives an error when using the postgres with Laravel. Running php artisan migrate on a fresh installation gives the following error.

Illuminate\Database\QueryException  : SQLSTATE[42704]: Undefined object: 7 ERROR:  collation "utf8mb4_bin" for encoding "UTF8" does not exist at character 57 (SQL: alter table "users" add column "stripe_id" varchar(255) collate "utf8mb4_bin" null, add column "card_brand" varchar(255) null, add column "card_last_four" varchar(4) null, add column "trial_ends_at" timestamp(0) without time zone null)

Steps To Reproduce:

  1. Fresh installation of laravel
  2. Change .env to use postgres as driver
  3. Add cashier as dependency
  4. php artisan migrate

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

We’ll need to find a universal way for this since it’s recommended by Stripe to add this.

Can confirm, had this issue too. Had to delete the collation from the migration.

One thing… not sure why utf8mb4_bin was used, since the key that comes back appears to me to be ascii salt+uuid(16) . I know Stripe suggests that it may be something else in the future, but given that they don’t say what, default collation is as good a guess as a utf8 scope-limited variant.

Just my 0.000002BC 😃

On Mon, Aug 26, 2019 at 9:37 AM Dries Vints notifications@github.com wrote:

I think maybe removing the default collation and noting something in the docs could be a good idea.

@staudenmeir https://github.com/staudenmeir do you think if we could add this to the schema builder to provide a solution for both postgres and mysql (and maybe the other two drivers as well)?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/laravel/cashier/issues/747?email_source=notifications&email_token=AADFWGNOCPYPOS5TAVDKPSTQGPTCNA5CNFSM4IL5CQJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5ESBLI#issuecomment-524886189, or mute the thread https://github.com/notifications/unsubscribe-auth/AADFWGLC7C5FGFOZ3OHXULLQGPTCNANCNFSM4IL5CQJQ .

I think maybe removing the default collation and noting something in the docs could be a good idea.

@staudenmeir do you think if we could add this to the schema builder to provide a solution for both postgres and mysql (and maybe the other two drivers as well)?