refactor: extract database scripts from creator classes to separate files#29
Merged
byerlikaya merged 24 commits intomainfrom Jan 19, 2026
Merged
Conversation
…inciple - Refactor database creator classes to use external SQL script files - Reduce code duplication by ~1500 lines across all database creators - Update DatabaseSchemaAnalyzer to support script-based approach - Improve maintainability and separation of concerns
- Add DatabaseScripts directory with SQL scripts for SQLite, SQL Server, PostgreSQL, MySQL - Add instnwnd.sql (Northwind sample database) for testing - Enable script-based database initialization for better maintainability
- Document new DatabaseScripts directory structure - Update database setup instructions to reflect script-based approach
…DatabaseBackups directories
…eparate script files
…improve schema handling
…management.backup.bak
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
examples/SmartRAG.Demo/DatabaseSetup/Creators/SqliteTestDatabaseCreator.cs
Fixed
Show fixed
Hide fixed
examples/SmartRAG.Demo/DatabaseSetup/Creators/SqliteTestDatabaseCreator.cs
Fixed
Show fixed
Hide fixed
examples/SmartRAG.Demo/DatabaseSetup/Creators/SqliteTestDatabaseCreator.cs
Fixed
Show fixed
Hide fixed
examples/SmartRAG.Demo/DatabaseSetup/Creators/SqliteTestDatabaseCreator.cs
Fixed
Show fixed
Hide fixed
examples/SmartRAG.Demo/DatabaseSetup/Creators/SqliteTestDatabaseCreator.cs
Fixed
Show fixed
Hide fixed
examples/SmartRAG.Demo/DatabaseSetup/Creators/SqliteTestDatabaseCreator.cs
Fixed
Show fixed
Hide fixed
examples/SmartRAG.Demo/DatabaseSetup/Creators/SqliteTestDatabaseCreator.cs
Fixed
Show fixed
Hide fixed
examples/SmartRAG.Demo/DatabaseSetup/Creators/SqliteTestDatabaseCreator.cs
Fixed
Show fixed
Hide fixed
…ovements v3.7.0 - Added Cross-Database Mapping Detector for automatic relationship detection - Improved SQL script extraction and database query generation - Enhanced security with SQL/command injection prevention - Prevented sensitive data leakage in logs and error messages - Updated all changelog files and version numbers to 3.7.0
byerlikaya
added a commit
that referenced
this pull request
Feb 5, 2026
…iles (#29) * refactor: extract SQL scripts from database creators and apply DRY principle - Refactor database creator classes to use external SQL script files - Reduce code duplication by ~1500 lines across all database creators - Update DatabaseSchemaAnalyzer to support script-based approach - Improve maintainability and separation of concerns * feat: add database setup scripts for all supported databases - Add DatabaseScripts directory with SQL scripts for SQLite, SQL Server, PostgreSQL, MySQL - Add instnwnd.sql (Northwind sample database) for testing - Enable script-based database initialization for better maintainability * docs: update README with database script extraction changes - Document new DatabaseScripts directory structure - Update database setup instructions to reflect script-based approach * refactor: reorganize database scripts into DatabaseSetup/scripts and DatabaseBackups directories * refactor: extract database creation scripts from creator classes to separate script files * refactor: update database services to use extracted script files and improve schema handling * refactor: update demo and API projects to use new database setup structure * chore: update configuration files and gitignore for new database structure * chore: exclude large backup files from git to comply with GitHub file size limits * chore: move large backup file to LargeFiles directory and allow salesmanagement.backup.bak * chore: add SMARTRAG_TEST_SORULARI.md to gitignore * feat: add cross-database mapping detector * refactor: improve database query generation and validation logic * docs: update changelog * refactor: update database parser and document search services * chore: update database setup scripts * fix: prevent SQL injection in database creator classes * fix: prevent command injection in database creator classes * fix: remove shell commands to prevent command injection * fix: prevent sensitive data leakage in logs and database handlers * fix: remove backup file path from exception messages * fix: remove tainted values from error log messages * [release] feat: add cross-database mapping detector and security improvements v3.7.0 - Added Cross-Database Mapping Detector for automatic relationship detection - Improved SQL script extraction and database query generation - Enhanced security with SQL/command injection prevention - Prevented sensitive data leakage in logs and error messages - Updated all changelog files and version numbers to 3.7.0 * docs: add v3.7.0 to version history accordion in docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 SmartRAG Pull Request
📝 Description
This PR refactors the database setup system by extracting SQL scripts from database creator classes into separate script files. This improves maintainability, follows DRY principles, and makes it easier to manage database initialization scripts.
Key Changes:
ITestDatabaseCreatorimplementations into separate script filesDatabaseSetup/scripts/directory for database creation scriptsDatabaseBackups/directory structureDatabaseBackups/LargeFiles/to comply with GitHub file size limits.gitignoreto exclude large backup files while allowing smaller ones (e.g.,salesmanagement.backup.bak)🔗 Related Issue
N/A - Internal refactoring
🔄 Type of Change
Please mark the relevant options:
🧪 Testing
Please describe the tests that you ran to verify your changes:
Testing Details:
📋 Checklist
🚨 Critical Rules Compliance
📸 Screenshots (if applicable)
N/A
📋 Additional Context
File Structure Changes:
DatabaseSetup/scripts/- Contains database creation SQL scripts for all providersDatabaseBackups/- Contains backup files for test database restorationDatabaseBackups/LargeFiles/- Contains large backup files (>100MB) excluded from GitScript Files Created:
DatabaseSetup/scripts/create_sqlite_database.sqlDatabaseSetup/scripts/create_sqlserver_database.sqlDatabaseSetup/scripts/create_postgresql_database.sqlDatabaseSetup/scripts/create_mysql_database.sqlBenefits:
🔄 Migration Guide (if breaking changes)
N/A - No breaking changes. This is a refactoring that maintains backward compatibility.
📊 Performance Impact
Note: This refactoring does not change runtime behavior, only improves code organization.
🔒 Security Considerations
Reviewer Guidelines: