added tasks and extra data, tested actual database
authorEduardo <[email protected]>
Mon, 2 Oct 2023 00:56:33 +0000 (02:56 +0200)
committerEduardo <[email protected]>
Mon, 2 Oct 2023 00:56:33 +0000 (02:56 +0200)
singletons/database_dao.gd

index 978cceec8bf1e1da8abfd36c62502712e2b956ea..a2e57a22a002ba055ee7363772d554f0a31cc226 100644 (file)
@@ -150,7 +150,7 @@ func _migrate_database_from_0_to_1():
        }
        var data := [
                {"key": "version", "value": "1"},
-               {"key": "install_time", "value": Time.get_unix_time_from_system()}
+               {"key": "install_time", "value": floori(Time.get_unix_time_from_system())}
                ]
 
        _db.create_table(table_name, columns)
@@ -162,16 +162,17 @@ func _migrate_database_from_0_to_1():
        table_name = "todo"
        columns = {
                "task": {"data_type": "text"},
-               "done": {"data_type": "int"},
+               "done": {"data_type": "int", "default": "0"}, # 0 false, 1 true
                "position": {"data_type": "int"},
-               "priority": {"data_type": "int"},
+               "priority": {"data_type": "int", "default": "1"},
                "created_at": {"data_type": "text"},
                "updated_at": {"data_type": "text"}
                }
        data = [
-               {"task": "Pick the laundry", "priority": 2, "created_at": Time.get_unix_time_from_system()},
-               {"task": "Feed the bunnuy", "priority": 3, "created_at": Time.get_unix_time_from_system()},
-               {"task": "Wash the dishes", "priority": 1, "created_at": Time.get_unix_time_from_system()},
+               {"task": "Pick the laundry", "priority": 2, "created_at": floori(Time.get_unix_time_from_system()), "updated_at": floori(floori(Time.get_unix_time_from_system()))},
+               {"task": "Feed the bunnuy", "priority": 3, "created_at": floori(Time.get_unix_time_from_system()), "updated_at": floori(Time.get_unix_time_from_system())},
+               {"task": "Wash the dishes", "created_at": floori(Time.get_unix_time_from_system()), "updated_at": floori(Time.get_unix_time_from_system())},
+               {"task": "Touch me to mark me as done", "created_at": floori(Time.get_unix_time_from_system()), "updated_at": floori(Time.get_unix_time_from_system())},
                ]
 
        _db.create_table(table_name, columns)
@@ -186,6 +187,8 @@ func _migrate_database_from_0_to_1():
                "description": {"data_type": "text"},
                "start_date": {"data_type": "text"},
                "end_date": {"data_type": "text"},
+               "repeat": {"data_type": "int", "default": "0"}, # 0 false, 1 true
+               "repeat_type": {"data_type": "text"}, # weekly, monthly, annually
                "color": {"data_type": "text"},
                "created_at": {"data_type": "text"},
                "updated_at": {"data_type": "text"}