@@ -172,11 +172,18 @@ impl Match {
172172 }
173173}
174174
175- /// Get the path to the database file in the AppData directory
175+ /// Get the path to the database file in the AppData directory.
176+ /// Dev builds use `dota_keeper_dev.db`; release builds use `dota_keeper.db`.
176177fn get_db_path ( ) -> Option < PathBuf > {
177178 dirs:: data_local_dir ( ) . map ( |mut path| {
178179 path. push ( "DotaKeeper" ) ;
180+
181+ #[ cfg( debug_assertions) ]
182+ path. push ( "dota_keeper_dev.db" ) ;
183+
184+ #[ cfg( not( debug_assertions) ) ]
179185 path. push ( "dota_keeper.db" ) ;
186+
180187 path
181188 } )
182189}
@@ -194,12 +201,6 @@ pub fn init_db() -> Result<Connection, String> {
194201 let conn = Connection :: open ( & path)
195202 . map_err ( |e| format ! ( "Failed to open database: {}" , e) ) ?;
196203
197- // Cleanup: Reset any "parsing" matches to "unparsed" (in case app crashed during parsing)
198- conn. execute (
199- "UPDATE matches SET parse_state = 'unparsed' WHERE parse_state = 'parsing'" ,
200- [ ] ,
201- ) . map_err ( |e| format ! ( "Failed to cleanup parsing state: {}" , e) ) ?;
202-
203204 // Create the matches table
204205 conn. execute (
205206 "CREATE TABLE IF NOT EXISTS matches (
@@ -226,6 +227,12 @@ pub fn init_db() -> Result<Connection, String> {
226227 [ ] ,
227228 ) . map_err ( |e| format ! ( "Failed to create matches table: {}" , e) ) ?;
228229
230+ // Cleanup: Reset any "parsing" matches to "unparsed" (in case app crashed during parsing)
231+ conn. execute (
232+ "UPDATE matches SET parse_state = 'unparsed' WHERE parse_state = 'parsing'" ,
233+ [ ] ,
234+ ) . map_err ( |e| format ! ( "Failed to cleanup parsing state: {}" , e) ) ?;
235+
229236 // Add parse_state column if it doesn't exist (for existing databases)
230237 let _ = conn. execute (
231238 "ALTER TABLE matches ADD COLUMN parse_state TEXT NOT NULL DEFAULT 'unparsed'" ,
0 commit comments