@@ -196,10 +196,22 @@ def build():
196196 if motor_count == 0 :
197197 print ("Warning: No motors imported. Check your data directory contents." )
198198
199- # --- FIX START ---
200- # You must commit the transaction before running VACUUM
199+ schema_version = 1
200+ database_version = int (datetime .now ().strftime ("%Y%m%d%H%M%S" ))
201+ generated_at = datetime .now ().isoformat ()
202+
203+ cursor .executemany (
204+ "INSERT OR REPLACE INTO meta (key, value) VALUES (?, ?)" ,
205+ [
206+ ("schema_version" , str (schema_version )),
207+ ("database_version" , str (database_version )),
208+ ("generated_at" , generated_at ),
209+ ("motor_count" , str (motor_count )),
210+ ],
211+ )
212+
213+ # Commit the transaction before running VACUUM
201214 conn .commit ()
202- # --- FIX END ---
203215
204216 # Optimize
205217 conn .execute ("VACUUM" )
@@ -216,9 +228,9 @@ def build():
216228 sha256 .update (f .read ())
217229
218230 meta = {
219- "schema_version" : 1 ,
220- "database_version" : int ( datetime . now (). strftime ( "%Y%m%d%H%M%S" )) ,
221- "generated_at" : datetime . now (). isoformat () ,
231+ "schema_version" : schema_version ,
232+ "database_version" : database_version ,
233+ "generated_at" : generated_at ,
222234 "motor_count" : motor_count ,
223235 "sha256" : sha256 .hexdigest (),
224236 "download_url" : "https://openrocket.github.io/motor-database/motors.db.gz"
0 commit comments