Understand dbmate core concepts
mainMigration Files
Stored in ./db/migrations by default. Files are timestamp-versioned. To modify a migration that has already been applied, you should rollback the migration first, as dbmate only tracks the version number, not the file content.
Schema File
Written to ./db/schema.sql by default. This is a complete dump of your database schema. It should be checked into source control to allow for easy diffing and quick database restoration without running every migration sequentially.
Schema Migrations Table
An internal table (default name: schema_migrations) used to record which migration versions have been applied to the database.