Giter Site home page Giter Site logo

Comments (7)

baraegh avatar baraegh commented on June 1, 2024 1

I have fixed this issue by using increment('id') instead of id() in 2014_10_12_000000_create_users_table.php file
& I use $table->unsignedInteger('user_id'); instead of $table->integer('user_id')->unsigned();
in 2016_07_29_171118_create_chatter_discussion_table.php file

from chatter.

baraegh avatar baraegh commented on June 1, 2024

same here

from chatter.

JamieCee20 avatar JamieCee20 commented on June 1, 2024

That did work however, now this error responds after changing the unsignedBigIntegers.

General error: 1005 Can't create table dashhound.chatter_discussion (errno: 121 "Duplicate key on write or update") (SQL: alter table chatter_discussion add constraint chatter_discussion_chatter_category_id_foreign foreign key (chatter_category_id) references chatter_categories (id) on delete cascade)

from chatter.

mahdi4k avatar mahdi4k commented on June 1, 2024

That did work however, now this error responds after changing the unsignedBigIntegers.

General error: 1005 Can't create table dashhound.chatter_discussion (errno: 121 "Duplicate key on write or update") (SQL: alter table chatter_discussion add constraint chatter_discussion_chatter_category_id_foreign foreign key (chatter_category_id) references chatter_categories (id) on delete cascade)

first you need to fresh database next use migrate

from chatter.

JamieCee20 avatar JamieCee20 commented on June 1, 2024

That did work however, now this error responds after changing the unsignedBigIntegers.
General error: 1005 Can't create table dashhound.chatter_discussion (errno: 121 "Duplicate key on write or update") (SQL: alter table chatter_discussion add constraint chatter_discussion_chatter_category_id_foreign foreign key (chatter_category_id) references chatter_categories (id) on delete cascade)

first you need to fresh database next use migrate

I did manage to get it working eveentually, apologies for not updating the issue. I've since created my own due to it being a university project and looks good having my own.

from chatter.

yazan-1999 avatar yazan-1999 commented on June 1, 2024

Migrating: 2016_07_29_171118_create_chatter_post_table
Migrated: 2016_07_29_171118_create_chatter_post_table (0.02 seconds)
Migrating: 2016_07_29_171128_create_foreign_keys

Illuminate\Database\QueryException

SQLSTATE[HY000]: General error: 1005 Can't create table forum.chatter_discussion (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table chatter_discussion add constraint chatter_discussion_user_id_foreign foreign key (user_id) references users (id) on delete cascade on update cascade)

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {

671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|

  +12 vendor frames 

13 database/migrations/2016_07_29_171128_create_foreign_keys.php:17
Illuminate\Support\Facades\Facade::__callStatic()

  +21 vendor frames 

35 artisan:37
Illuminate\Foundation\Console\Kernel::handle()

increments('id'); $table->integer('chatter_category_id')->unsigned()->default('1'); $table->string('title'); $table->unsignedInteger('user_id'); $table->boolean('sticky')->default(false); $table->integer('views')->unsigned()->default('0'); $table->boolean('answered')->default(0); $table->timestamps(); }); } public function down() { Schema::drop('chatter_discussion'); } }

from chatter.

yazan-1999 avatar yazan-1999 commented on June 1, 2024

help please ;(

from chatter.

Related Issues (20)

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.