-
Notifications
You must be signed in to change notification settings - Fork 33
Add SQLite3 support and meta table
#31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
meta table
meta tablemeta table
|
I've tried to update an existing test project to the v2 schema and it worked just fine. There seems to be an issue when rolling back though: defmodule PhxNewPostgres.Repo.Migrations.UpdateErrorTrackerToV2 do
use Ecto.Migration
def up, do: ErrorTracker.Migration.up(version: 2)
def down, do: ErrorTracker.Migration.down(version: 2)
end |
crbelaus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just tested this on both PostgreSQL and Sqlite3 and works great. I very much prefer using the meta table instead of relying on table comments.
There is a problem when rolling back the new Postgres migration though.
|
@crbelaus I have updated the change and also unified the migration code for SQL databases, so most of the logic is now common on both migrators. I have also fixed the issue with the rollback, which was because of the migration of the table in PostgreSQL and not supporting the comment version anymore. Please, let me know how you see it now 🤗 |
crbelaus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again and it is working great!
meta tablemeta table
This change adds support for SQLite3 storage of errors and includes a new
error_tracker_metatable to store metadata needed for ErrorTracker to function properly - like managing migration versions.Aside from adding support to SQLite3, which was as easy as expected, we have also added a way to track migration versions that should work in any SQL database (although only PostgreSQL and SQLite3 are currently supported). That KV store table will also work in the future to store runtime configuration, for example.
In this change we are also migrating PostgreSQL systems to use this new table, which means migrating from using table comments to store migration version to use this new table. In order to do so, a new version of the schema (
2) have been added and current systems need to add a new migration:As for SQLite3 migrations, migrations start at
V02to maintain the same version IDs on all platforms.--
Development script has also been updated and this feature can be tested using the new config flags that can be seen in
dev.local.example.exs.