-
Notifications
You must be signed in to change notification settings - Fork 123
Closed
Description
If I have a env with webpush.table_name
that is long, then the index for $table->morphs('subscribable');
can be too long.
I get this error
SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'notification_push_subscriptions_subscribable_type_subscribable_id_index' is too long (Connection: aktivbo_survey, SQL: alter table `notification_push_subscriptions` add index `notification_push_subscriptions_subscribable_type_subscribable_id_index`(`subscribable_type`, `subscribable_id`))
A solution to this could be to have the index already defined like so:
Schema::connection(config('webpush.database_connection'))->create(config('webpush.table_name'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->morphs('subscribable', 'short_index_name'); // like so
$table->string('endpoint', 500)->unique();
$table->string('public_key')->nullable();
$table->string('auth_token')->nullable();
$table->string('content_encoding')->nullable();
$table->timestamps();
});
Have a lovely day!
Metadata
Metadata
Assignees
Labels
No labels