Created Migrations for Database

Created migrations for database to allow modification in the future,
without loosing data.
This commit is contained in:
Mario Steele 2026-03-06 22:44:02 -06:00
parent b0ad37eda2
commit 1de7baf717
4 changed files with 104 additions and 0 deletions

34
migrations/001_initial.gd Normal file
View file

@ -0,0 +1,34 @@
extends Migration
func _up() -> void:
var table: Migration.TableDef
# Create Table chatters
table = create_table("chatters")
table.add_column("id", Types.DataType.INT, Types.Flags.PRIMARY_KEY | Types.Flags.NOT_NULL, {})
table.add_column("twitch_id", Types.DataType.STRING, Types.Flags.NOT_NULL, {})
table.add_column("nickname", Types.DataType.STRING, Types.Flags.NONE, {})
table.add_column("known_engine", Types.DataType.STRING, Types.Flags.NONE, {})
table.add_column("steam_games", Types.DataType.ARRAY, Types.Flags.NONE, {})
table.add_column("itch_games", Types.DataType.DICTIONARY, Types.Flags.NONE, {})
table.add_column("urls", Types.DataType.DICTIONARY, Types.Flags.NONE, {})
table.add_column("is_indie_game_dev", Types.DataType.BOOL, Types.Flags.NONE, {})
table.add_column("is_on_team", Types.DataType.BOOL, Types.Flags.NONE, {})
table.add_column("level", Types.DataType.INT, Types.Flags.NONE, {})
table.add_column("auto_shoutout", Types.DataType.BOOL, Types.Flags.NONE, {})
table.add_column("shoutout_as_devteam", Types.DataType.BOOL, Types.Flags.NONE, {})
table.add_column("notes", Types.DataType.STRING, Types.Flags.NONE, {})
table.add_column("scores", Types.DataType.DICTIONARY, Types.Flags.NONE, {})
table.add_column("extra_data", Types.DataType.DICTIONARY, Types.Flags.NONE, {})
table.add_column("first_seen", Types.DataType.REAL, Types.Flags.NONE, {})
table.add_column("last_seen", Types.DataType.REAL, Types.Flags.NONE, {})
func _down() -> void:
# Drop Table chatters
drop_table("chatters")