Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in migration on MariaDB: Specified key was too long #37

Closed
dryabov opened this issue Sep 18, 2018 · 1 comment
Closed

Error in migration on MariaDB: Specified key was too long #37

dryabov opened this issue Sep 18, 2018 · 1 comment

Comments

@dryabov
Copy link
Contributor

dryabov commented Sep 18, 2018

https://github.com/freescout-helpdesk/freescout/blob/3538a418177db6176feba4d811cbd5d688c5ad99/database/migrations/2018_07_09_053559_create_customers_table.php#L42

I'd either reduce lengths of first_name and last_name columns or rewrite up method as (WARNING: not tested!)

    public function up()
    {
        $connection = config('database.default');
        $driver = config("database.connections.{$connection}.driver");

        // https://developer.helpscout.com/mailbox-api/endpoints/customers/get/
        Schema::create('customers', function (Blueprint $table) use ($driver) {

            /* skipped */

            // Indexes
            // For ajax search
            if ($driver === 'mysql') {
                $table->index([DB::raw('first_name(191), last_name(191)')], 'customers_first_name_last_name_index');
            } else {
                $table->index(['first_name', 'last_name']);
            }
        });
    }
@freescout-helpdesk
Copy link
Contributor

e2c2be7

@ghost ghost mentioned this issue Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants