How is the schema version identified? #187
-
I have the following migration: # ./migrations/1-init/up.sql
CREATE TABLE "documents" (
"hash" BLOB CHECK(length(32)),
"document" BLOB NOT NULL,
PRIMARY KEY("hash")
); which I apply with: MIGRATIONS.to_latest(&mut conn).unwrap(); This works with an empty database and creates the table as is defined. There is no table that holds current schema version. When I delete the table manually and rerun the migration nothing happens. How does rusqlite_migration know when a migration was applied or not in the past? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @danielniccoli,
In layman terms it means we use the This has the benefit of being extremely simple, but one disadvantage is that we can't verify if migrations have not been modified after they have already been applied. |
Beta Was this translation helpful? Give feedback.
Hello @danielniccoli,
As mentioned in the
README.md
file:In layman terms it means we use the
user_version
field to store a counter of how many migrations (in the order you provide them in) have already been applied. If you add a new migration and apply it, this counter is also incremented to indicate that.This has the benefit of being extremely simple, but one …