class_name db_update static func update(DBMS): while true: var version = get_version(DBMS) match version: [0,1,0]: break _: exec_sql_file(DBMS, "res://data_model/schema.sql") #insert_test_data(DBMS) static func get_version(DBMS): var version = DBMS.query("select * from Version", []) return [0,0,0] if version.size() == 0 else [version[0]['major'],version[0]['minor'],version[0]['patch']] static func exec_sql_file(DBMS, file): var f = File.new() f.open(file, File.READ) var sql = f.get_as_text() f.close() DBMS.query(sql,[]) static func insert_test_data(DBMS): exec_sql_file(DBMS, "res://data_model/test_data.sql")