Comments (3)
I have got this same error.
I checked and found that initially the user_roles
table created with 3 columns user_id, user_role & user_type
with primary index in database/migrations/2017_09_14_000000_core_v1.php
And in database/migrations/2022_07_21_000000_core_v305.php
its dropping primary index for user_id, user_role & user_type
then adding primary index for user_id, user_role
and last dropping the column user_type
So I assume that the purpose of this 2022_07_21_000000_core_v305.php
migration is dropping the user_type
column.
Instead of dropping primary index for all three column primary index I just drop only user_type
index then drop the user_type
column.
And it worked. I don't know any underlying consequences 😀
This is the code:
public function up()
{
Schema::table('user_roles', function (Blueprint $table) {
$table->dropPrimary(['user_type']);
// $table->dropPrimary(['user_id', 'role_id', 'user_type']);
// $table->primary(['user_id', 'role_id']);
});
Schema::table('user_roles', function (Blueprint $table) {
$table->dropColumn('user_type');
});
}
from akaunting.
I got this error too.
In MySQL, you can't drop a primary key with "DROP INDEX IF EXISTS" as MySQL does not support the "IF EXISTS" clause with "DROP INDEX" or "DROP PRIMARY KEY". If a primary key does not exist, attempting to drop it results in an error, as you experienced.
I check on the database and I didn't see the primary key that we want to delete using this migration code
$table->dropPrimary(['user_id', 'role_id', 'user_type']);
So I've just tried to change the migration file database/migrations/2022_07_21_000000_core_v305.php
like this
public function up()
{
DB::statement('ALTER TABLE user_roles ADD PRIMARY KEY(`user_id`, `role_id`)');
}
Note: for column user_roles
, make sure to include the DB_PREFIX.
e.g: if your DB_PREFIX=ak, So you need to change the table name to ak_user_roles
from akaunting.
This issue solved this commit
from akaunting.
Related Issues (20)
- Error in npm install HOT 3
- Sorting feature on the transfer page is not working
- Sorting feature on tax settings page not working
- Invoice and Email Service settings are not getting saved. HOT 3
- Recurring with adviced crontab not doing anything HOT 1
- Recurring Invoice does not attach PDF to generated email
- Invoice items price gets multiplied when currency accuracy is changed HOT 1
- Custom invoice colour without hash sign is not interpreted on invoice
- 31st Dec not reflected in cash flow plot
- SQL constrain violation on uploading media with the same name HOT 1
- Akaunting 3.1.5 , after database population step, script doesn't switch to admin tab HOT 4
- Error while installing: Uncaught Error: Failed opening required '/home/ubuntu/akaunting/bootstrap/. HOT 3
- Articles are missing when editing a draft invoice HOT 1
- Error when export invoices HOT 1
- Deprecated: Optional parameter HOT 2
- Bug in new release 3.1.7 HOT 1
- Attachments in bills/invoices not downloadable anymore after update
- Menu vanished after update HOT 2
- Unable to install the app if your database is SQLite
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from akaunting.