Forum

Ask, reply and learn. Join the community of Akaunting.

New Discussion

Syntax error or access violation: 1091 Can't DROP 'PRIMARY'

Arash Azizvand   ( User )

Commented 11 months ago

After the database settings, it does not go to the next step and it encounters the following error

[09:32:33] LOG.error: SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'PRIMARY'; check that column/key exists (Connection: mysql, SQL: alter table `1aj_user_roles` drop primary key) {
"exception": {
"errorInfo": [
"42000",
1091,
"Can't DROP 'PRIMARY'; check that column\/key exists"
],
"connectionName": "mysql"
}
}

Prodabit Prodabit   ( User )

Commented 11 months ago

MySQL/MariaDB in some versions does not accept the drop index format used by Laravel. I stayed all day to find out that my MySQL 8.1 was the problem. I installed MariaDB 10.2 and the installation completed without any problems.

Saleem Ahmed   ( User )

Commented 11 months ago

in my premises, I made it to work as following:
1. In database/migrations/2017_09_14_000000_core_v1.php commented line: 402 and changed line 407 to $table->primary(['user_id', 'permission_id']);
2. In database/migrations/2022_07_21_000000_core_v305.php, commented all code within public function up()

And it started working.

Saleem Ahmed   ( User )

Commented 11 months ago

Sorry
line numbers in database/migrations/2017_09_14_000000_core_v1.php were wrongly written.
line 413 is to be commented, ie "$table->string('user_type');"
and $table->primary(['user_id', 'role_id', 'user_type']); (line 415) to be changed to $table->primary(['user_id', 'role_id']);

Please login or register to leave a response.

Showing 1 to 4 of 4 discussions