Giter Site home page Giter Site logo

opariltay / simple-desk-booking Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 3.0 31.76 MB

Easy-to-use desk booking software which allows users to reserve a full-day seat at the workplace.

License: MIT License

PHP 63.92% JavaScript 1.47% Blade 14.35% CSS 20.26%
booking booking-system desk-booking laravel laravel-backpack laravel-breeze php reservation reservation-system

simple-desk-booking's Issues

Error: Specified key length exceeds maximum limit during migration

Bug Description:

When attempting to create a migration for the personal_access_tokens table in Laravel, a "Specified key was too long" error occurs. This error arises because Laravel tries to create an index with a key length that exceeds the maximum allowed by the database engine (MySQL), causing the migration to fail.

Fixed Code:

The issue can be resolved by adjusting the migration code to specify a custom index name with a shorter key length for the tokenable_type column. Additionally, we explicitly define the tokenable_type as a string with the desired length and tokenable_id as an unsigned big integer. After defining the columns, we add the index separately to ensure it's created with the correct length.

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePersonalAccessTokensTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('personal_access_tokens', function (Blueprint $table) {
            $table->id();
            
            // Use a smaller index key length
            $table->string('tokenable_type', 191); // Adjust the length as needed
            $table->unsignedBigInteger('tokenable_id');
            
            $table->string('name');
            $table->string('token', 64)->unique();
            $table->text('abilities')->nullable();
            $table->timestamp('last_used_at')->nullable();
            $table->timestamps();

            // Add an index separately
            $table->index(['tokenable_type', 'tokenable_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('personal_access_tokens');
    }

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.