ZeroKnight / ZeroBot

My personal IRC/Multi-protocol Bot created (and re-created) for education and amusement.
MIT License
1 stars 0 forks source link

Start creating and using database migration scripts #41

Open ZeroKnight opened 10 months ago

ZeroKnight commented 10 months ago

At some point, it would be a good idea to begin using database migration scripts, e.g. scripts to take a database schema from one version to another. The user_version pragma will be useful as it can be incremented each time the core database schema changes, which the migration scripts can then use to determine what/when to run.

To allow feature modules a similar opportunity (independent from core and one another), a core table can be created to track their own version numbers, e.g. feature_db_version(name TEXT, version INTEGER).

The sqlite_schema table and table_info pragma can also be helpful for querying and making decisions based on the current database state.

See this blog post for an interesting implementation technique.

This can be implemented after or alongside #40.

ZeroKnight commented 10 months ago

This would probably only be worthwhile once the overall design of everything settled down. Right now it's likely that things will continue to change very frequently.