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

Adding a column - generator tries to make it an auto-incrementing key #404

Open
redknitin opened this issue Oct 5, 2014 · 1 comment
Open

Comments

@redknitin
Copy link

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

@mfutselaar
Copy link

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.

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