-
Notifications
You must be signed in to change notification settings - Fork 164
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
refactor(backend): db session locking to support exclusive mode #1380
Conversation
518c456
to
02ca4ba
Compare
02ca4ba
to
2657f72
Compare
4ff8dd5
to
9a6025f
Compare
066c003
to
fadddc5
Compare
5702228
to
7a0b305
Compare
@kroky I tested with postgresql and mysql I got a new error with postgres:
|
9da4405
to
1ee9fd1
Compare
You raised valid points, and I agree that maintaining a custom migration system could become complex over time. If we consider using .sql files for database migrations, we must address compatibility across different database engines. SQL syntax can vary between systems like MySQL, PostgreSQL, and SQLite. To manage this, we could organize migrations into subdirectories by engine, such as:
The migration runner would detect the current database engine and execute only the files from the relevant directory. This keeps the migration process straightforward while supporting multiple database systems. Alternatively, leveraging a well-maintained package from Packagist could be a more robust and scalable solution. Libraries such as bizley/migration offer extensive support for multiple database systems and advanced features like schema management. Another option is doctrine/migrations, which provides powerful migration capabilities but may introduce additional complexity. Each approach has its strengths. Using .sql files keeps things simple and transparent but requires custom implementation and careful handling of database-specific syntax(ex: 20241209040300_add_lock_to_hm_user_session_table.sql). Adopting a mature package simplifies maintenance and enhances functionality but adds external dependencies and a learning curve. @kroky What can you advise me ? Here is a screenshot that explains the incompatibility between databases using .sql files: |
1ee9fd1
to
2dfe62d
Compare
Yes, both options are valid. I think it is more in the spirit of cypt to go with the simpler approach and use per-database migration file. Cypht database is relatively simple, schema changes are not done often, so it doesn't make sense to me to include big dependencies as doctrine now. |
Understood, I will create the SQL files for each DBMS and test then ping you. |
2dfe62d
to
cd0b746
Compare
@kroky I updated schema for all databases(sqlite,pgsql and mysql). you can review. |
database/migrations/pgsql/20241209010100_create_hm_user_table.sql
Outdated
Show resolved
Hide resolved
157a999
to
4f169ca
Compare
… native file session storage works
…etup with column migration logic
…ssion locking and concurrency
4f169ca
to
b14bb79
Compare
b14bb79
to
e1d3d99
Compare
e1d3d99
to
fae09a8
Compare
fae09a8
to
6911557
Compare
Related task item89272