NextLS.DB.Schema (next_ls v0.10.3-retired-from-hex)

The Sqlite3 database schema.

First, you are probably asking yourself, why doesn't this use Ecto?

Well, because I didn't want to. And also because I am attempting to restrict this project to as few dependencies as possible.

The Ecto migration system is meant for highly durable data, that can't and shouldn't be lost, whereas the data here is more like a fast and efficient cache.

Rather than coming up with convoluted data migration strategies, we follow the following algorithm.

  1. Create the schema table if needed. This includes a version column.
  2. If the max version selected from the schema table is equal to the current version, we noop and halt. Else, if the max version is less than the current one (compiled into this module) or nil we "upgrade" the database.
  3. Unless halting, we drop the non-meta tables, and then create them from scratch
  4. Return a value to signal to the caller that re-indexing is necessary.

Link to this section Summary

Link to this section Functions