Closed petrovyuri closed 1 year ago
Solved problem, check connection and reinit.
if (db.connection().isClosed) { db = initDatabase(); }
@petrovyuri Hey! I have the same problem in the production. And I think when errors come from plugin then we get closed connection. As my db variable is created in the main method and is passed to the repository models then after this I get constantly issue with closed connection.
I am going to try your approach before creating an issue about it.
Solved problem, check connection and reinit.
if (db.connection().isClosed) { db = initDatabase(); }
This is extremely bad code, because your initDatabase
MUST be in a completely separate layer of abstractions than your method which actually performs any request to check for it's isClosed
state...
Hi, thank you very much for your wonderful plugin. I'm facing a very strange problem. After Postgres returns an error about the uniqueness of names, then the error about the lack of connection to the database is constantly returned.
[log] PostgreSQLException (PostgreSQLSeverity.error 23505: duplicate key value violates unique constraint "__unique" Detail: Key (email, username)=(1, 1) already exists. Table: user_models Constraint __unique ) [log] #0 _PostgreSQLExecutionContextMixin._query connection.dart:514
1 _PostgreSQLExecutionContextMixin.query
connection.dart:475
2 Database.query
database.dart:91