Skip to content

fix: ensure AppDataSource is initialized before registering storage file services and update repository initialization#309

Merged
egalvis27 merged 1 commit intomainfrom
fix/database-initialization-after-login
Apr 13, 2026
Merged

fix: ensure AppDataSource is initialized before registering storage file services and update repository initialization#309
egalvis27 merged 1 commit intomainfrom
fix/database-initialization-after-login

Conversation

@egalvis27
Copy link
Copy Markdown

What is Changed / Added


An issue was encountered during login where a critical database table required for Fuse functions was not created. Some tables were being initialized when the application started, and others when the user logged in, which caused a race condition where Fuse attempted to run queries before the table existed.

The initialization of the tables has been centralized so that all tables exist before logging in, thereby avoiding this problem, and the entire database initialization process has been consolidated into a single location.

…ile services and update repository initialization

const dataSource = await TypeOrmStorageFilesDataSourceFactory.create();
if (!AppDataSource.isInitialized) {
throw new Error('AppDataSource must be initialized before registerStorageFilesServices');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when we throw this exception? is it handled or it just bubbles up and stops the execution entirely? if its the later, shouldnt we handle it properly?

@sonarqubecloud
Copy link
Copy Markdown

@egalvis27 egalvis27 merged commit fe43182 into main Apr 13, 2026
9 checks passed
@egalvis27 egalvis27 deleted the fix/database-initialization-after-login branch April 13, 2026 15:07
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.

2 participants