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

Enhance database initialization in db.go #2645

Merged
merged 1 commit into from
Jan 21, 2025
Merged

Conversation

izzzzzi
Copy link
Contributor

@izzzzzi izzzzzi commented Jan 19, 2025

  • Updated GORM configuration to skip default transactions and prepare statements.
  • Modified the database connection string to include caching and journal mode settings.
  • Executed several PRAGMA statements to optimize SQLite performance and enable foreign key support.

These changes improve database handling and performance in the application.

- Updated GORM configuration to skip default transactions and prepare statements.
- Modified the database connection string to include caching and journal mode settings.
- Executed several PRAGMA statements to optimize SQLite performance and enable foreign key support.

These changes improve database handling and performance in the application.
@MHSanaei
Copy link
Owner

Let's test it for the next version to see what is happening.

@MHSanaei MHSanaei merged commit 66fe841 into MHSanaei:main Jan 21, 2025
@Vladimir-sys-alt-del
Copy link

Errors after upgrading from v2.4.11 to v2.5.0 on Ubuntu 24.04.1:

2025-01-28T04:44:47.735681-05:00 mail systemd[1]: Started x-ui.service - x-ui Service. 2025-01-28T04:44:47.755488-05:00 mail x-ui[2828555]: 2025/01/28 04:44:47 Starting x-ui 2.5.0
2025-01-28T04:44:47.758069-05:00 mail x-ui[2828555]: 2025/01/28 04:44:47 Error auto migrating model: FOREIGN KEY constraint failed
2025-01-28T04:44:47.758188-05:00 mail x-ui[2828555]: 2025/01/28 04:44:47 Error initializing database: FOREIGN KEY constraint failed
2025-01-28T04:44:47.760615-05:00 mail systemd[1]: x-ui.service: Main process exited, code=exited, status=1/FAILURE
2025-01-28T04:44:47.760799-05:00 mail systemd[1]: x-ui.service: Failed with result 'exit-code'.

Returning to 2.4.11 version works fine.

@genrihx2
Copy link

Please do developer fix migrating model: FOREIGN KEY constraint failed

Ubuntu 24.04.1 LTS

@foxdodo
Copy link

foxdodo commented Feb 2, 2025

same error Error auto migrating model: FOREIGN KEY constraint failed
3x-ui 2.5.0 running in docker x86

@lopatin777
Copy link

Error after update docker install to v2.5.0.

3x-ui | 2025/02/02 12:25:57 Starting x-ui 2.5.0
3x-ui | (0x2a50300,0xc000041b80)
3x-ui | 2025/02/02 12:25:57 Error auto migrating model: FOREIGN KEY constraint failed
3x-ui | 2025/02/02 12:25:57 Error initializing database: FOREIGN KEY constraint failed

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

Successfully merging this pull request may close these issues.

6 participants