nicholas-ochoa/OpenSC2K

Switch to Sequelize or other ORM

DevNebulae opened this issue · 5 comments

I am currently working on issue #17, however, the issue is that it feels rather hacky to require the database file with the bundle, since it it needs to be build specific. In other words, the database needs to reside somewhere in the dist or build folder and does not need to be bundled with the build. The database needs to be created on startup. Am I correct in stating this or is there something I am missing?

I'm planning to move away from the current SQLite storage to something native JS. The database currently contains the list of tiles and their properties along with the loaded/saved cities - for now it needs to be included.

So if I understand correctly, the database file contains a list of all the tile sprites (or their location) and the data about a city (which building is where, roads, streets, etcetera).

Correct - at the moment it's a table of tiles (and their attributes) and a table of map data (position of each cell, what building, terrain, zone, network, any other attributes). Nothing that can't be stored another way, initially they were both a JSON file, but the city file is 16384 entries for a standard 128x128 sized city.

I am currently looking into ORM's for JavaScript and I want to recommend TypeORM. It also has bindings for WebSQL.

I've removed the SQLite dependency entirely, closing this out.