Skip to main content

All Questions

Tagged with
0 votes
1 answer
72 views

How to Define a money Data Type in Laravel Migrations for SQL Server?

I'm working with Laravel migrations and need to define a money column type in SQL Server. However, Laravel's schema builder does not provide a direct money type. I’ve considered two approaches: Using ...
Filbert Umbawa's user avatar
0 votes
0 answers
35 views

SQLSTATE[HY000]

Need help to solve a SQL error in laravel I need to migrate the database tables but it displays an error "Foreign key constraint is incorrectly formed" in the client table because the ...
Lina Boukhari's user avatar
-2 votes
3 answers
535 views

Laravel migration failing because the database is empty

I've been building a laravel application, then xampp gave so many issues so I deleted it with the databases. Then created new empty database and tried to migrate, but it giving me this error: ...
yasir's user avatar
  • 127
0 votes
1 answer
159 views

Alter a column to perform onDelete('restrict') when foreign key is also primary key of self table for Laravel migrations

I have two table (**tbl_Traditional_Policysummery_KYC **& tbl_UnderwritingWorkSheetInfo) both table's primary key is PolicyNo I want to restrict the delete operation of table **...
MD TAREK HOSSEN's user avatar
0 votes
1 answer
280 views

Illuminate\Database\QueryException SQLSTATE[HY000]: General error: 1005 Can't create table

I try to migrate "comment" table with foreing key from "blogPost" table, so I had this error about foring key: this is code error: SQLSTATE[HY000]: General error: 1005 Can't ...
FZ_ZID's user avatar
  • 37
2 votes
2 answers
2k views

Laravel 9 Foreign Key Constraints issue on INSERT

I tried following what the documentation says here regarding foreign keys: https://laravel.com/docs/9.x/migrations#foreign-key-constraints I have 3 tables that need to be connected to each other: ...
Hadrian Clayton's user avatar
0 votes
1 answer
271 views

Laravel: how to query a table, take the first value of from a column for each unique item_id and assign it to another table column

I am completely new to Laravel and migrations in general. I have 2 tables: claim_items and claims. The table claim_items has 2 columns: claim_id and refers to the id of the table claim (1 claim might ...
Andrea D_'s user avatar
  • 2,151
0 votes
3 answers
2k views

laravel date and time column concat to datetime column

An error occurred during database design and the date time was handled in a separate field, which I would like to merge using migration. Is there some simple way to move the data in the date and time ...
Bálint Bakos's user avatar
2 votes
1 answer
480 views

Laravel attribute with default value is set, still gives an error Integrity constraint violation 'priority' cannot be null

Migration: $table->tinyInteger('priority')->default(1); Controller Method: /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @...
Ronak Ahir's user avatar
1 vote
1 answer
3k views

BadMethodCallException || Method Illuminate\Database\Schema\Blueprint::after does not exist

BadMethodCallException ... Method Illuminate\Database\Schema\Blueprint::after does not exist. i can't migration my database for my project... this is the error i faced ....................................
Rajib Bin Alam's user avatar
0 votes
3 answers
2k views

SQLSTATE[42S22]: Column not found: 1054 Unknown column "name" even though it exists in my db table

Error even though the column exists in the migration table. SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'field list' (SQL: insert into tasks (name, description, statuse_id, ...
silvijasaule's user avatar
0 votes
1 answer
2k views

Laravel Migration: Combine multiple values in a new colum

i'm trying to make a migration using Laravel. The idea is to get the values of columns 'code' and 'id' in different tables, and merge them into a column 'name' with '-' separators. So in part it is a ...
Agustin Nigrelli's user avatar
0 votes
1 answer
74 views

Solve laravel migration problem with foreign keys

I wrote the migrations and they worked well until i tried to make them on delete cascade i added $table->engine = 'InnoDB' and that was ok. but in seeders, when i tried to run them i got an error ...
Matinwd's user avatar
3 votes
2 answers
5k views

Change String to Decimal Laravel Migration

I'm trying to Alter my current table and can do it just fine with a SQL Query in my migration file like this: <?php public function up() { Schema::table('xyz', function (Blueprint $...
daugaard47's user avatar
  • 1,868
0 votes
2 answers
93 views

Laravel can't add foreign key even if assigned as unsigned

I have a table named choices and I want the choice_id to be primary key BUT not auto increment because I got a seeder for it. Here is my migration for choices Schema::create('choices', ...
draw134's user avatar
  • 1,197

15 30 50 per page