2shady4u / godot-sqlite

GDExtension wrapper for SQLite (Godot 4.x+)
MIT License
895 stars 79 forks source link

Allow for resource-sqlite conversions #106

Open feefladder opened 1 year ago

feefladder commented 1 year ago

Is your feature request related to a problem? Please describe.

Editing a database by hand is cumbersome for people that may want to work on my project, and therefore I put all my data in .tres resource files. I am now thinking of moving to SqLite. However, to do this manually costs a lot of work and I have already made a nice, well-thought of data structure with the resource files.

Describe the solution you'd like

A script/set of scripts to:

  1. create database tables from existing definitions of resources
  2. populate the tables from existing .tres files
  3. (lower priority) convert the tables (whenever updated) back to a collection of .tres files

Describe alternatives you've considered

This may or may not be within the scope of this plugin. I have considered making a plugin/set of scripts myself for this, but am a bit low on resources, so may not have time for it in the future.

Additional context

image image

2shady4u commented 1 year ago

This would be an interesting addition, but I currently don't have time to work on this 😞

Just a heads-up that the SQLite plugin already allows you to import and export databases from JSON files 👀

feefladder commented 1 year ago

I have made something that works, albeit not the most beautiful code (I did not know how to get property lists of builtin types, so hardcoded them...) creating a table: https://github.com/feefladder/ahf/blob/f3cb3e263902f4de70d54b2ef3a792ed5ebf1600/scripts/controllers/initializer.gd#L129

adding a row from the table: https://github.com/feefladder/ahf/blob/f3cb3e263902f4de70d54b2ef3a792ed5ebf1600/scripts/controllers/initializer.gd#L141

It does require that the get_class method is overridden for the resource, so a table is made with the resource name. this should be solved with https://github.com/godotengine/godot/pull/62273