- 
                Notifications
    
You must be signed in to change notification settings  - Fork 142
 
feat(datastore): add SQLite database backend support #1529
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
base: main
Are you sure you want to change the base?
Conversation
| 
           [APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. 
Needs approval from an approver in each of these files:
 
      Approvers can indicate their approval by writing   | 
    
Signed-off-by: Chanakya TS <[email protected]>
Signed-off-by: Chanakya TS <[email protected]>
Signed-off-by: Chanakya TS <[email protected]>
SQLite generates different Go types (int32 vs int64, int32 vs bool) compared to MySQL/PostgreSQL due to SQLite's type system. Since the schema files are shared between database backends, SQLite schema validation would always fail with type differences. Signed-off-by: Chanakya TS <[email protected]>
…greSQL Changes made to ensure GORM generates identical struct types across all database backends: - Changed INTEGER to BIGINT for all timestamp fields (create_time_since_epoch, last_update_time_since_epoch, milliseconds_since_epoch) - Changed INTEGER to BOOLEAN for all boolean fields (is_custom_property, bool_value, is_index_step) - Restored SQLite schema validation in CI workflow This ensures SQLite generates the same Go types: - BIGINT maps to int64 (matching MySQL bigint) - BOOLEAN maps to bool (matching MySQL tinyint(1)) - Maintains schema consistency across all database backends Signed-off-by: Chanakya TS <[email protected]>
…tions SQLite's INTEGER PRIMARY KEY (without AUTOINCREMENT) is the proper equivalent to MySQL's AUTO_INCREMENT that generates the same GORM struct tags: - INTEGER PRIMARY KEY maps to int32 with autoIncrement:true - AUTOINCREMENT creates different GORM behavior (*int32 without autoIncrement tag) This should now generate identical Go struct types as MySQL/PostgreSQL. Signed-off-by: Chanakya TS <[email protected]>
Adds custom dataTypeMap and field tag processing for SQLite to ensure generated Go structs match MySQL/PostgreSQL format: - INTEGER PRIMARY KEY fields generate int32 with autoIncrement:true tag - Custom field processing adds autoIncrement tag for primary key fields - Maintains type consistency across all database backends This ensures SQLite schema validation passes in CI by generating identical Go struct types as other database backends. Signed-off-by: Chanakya TS <[email protected]>
Signed-off-by: Chanakya TS <[email protected]>
Signed-off-by: Chanakya TS <[email protected]>
Signed-off-by: Chanakya TS <[email protected]>
Signed-off-by: Chanakya TS <[email protected]>
| 
           Hi, I would really appreciate it if somebody can review this PR. Thank you.  | 
    
| 
           Hey @Chanakya-TS ! Sorry for the delay, adding support to a new db should be done with care as we still found issues with postgresql tests as of last week 😢 I would consider adding both e2e tests and (for now at least) try running fuzz tests locally before reviewing the PR  | 
    
feat(datastore): add SQLite database backend support
Description
This PR adds SQLite as a third database backend option for the Model Registry project, alongside the existing MySQL and PostgreSQL support. This implementation provides a lightweight, file-based database solution ideal for development environments, testing, and
single-instance deployments.
Key Features:
start/sqlite,stop/sqlite,gen/gorm/sqlite)Technical Implementation:
Key Technical Fixes:
INTEGER PRIMARY KEYinstead ofAUTOINCREMENTfor better SQLite performanceHow Has This Been Tested?
Testing Environment:
Tests Performed:
go test ./internal/datastore/embedmd/sqlite/...):memory:) and file-based database connectionsmake buildand runs with SQLite backend