Laravel-4-Generators
Laravel-4-Generators copied to clipboard
Adding a column - generator tries to make it an auto-incrementing key
I tried to add a column to a table, but it seems to want to make the column a primary key which is why it fails. The commands I ran are: php artisan generate:migration add_account_id_to_transactions_table --fields="account_id:integer(11)" php artisan migrate
The errors displayed are the following
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table def
inition; there can be only one auto column and it must be defined as a key
(SQL: alter table transactions
add account_id
int not null auto_increme
nt primary key)
[PDOException] SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table def inition; there can be only one auto column and it must be defined as a key
What is the type in the migration file? If it is defined as integer and not as increments, it's a Laravel issue, not a generator one.