Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
github.com/echlebek/migration
This is a fork of github.com/BurntSushi/migration that's written to work with github.com/jackc/pgx instead of database/sql. It only works with PostgresQL.
Package migration for Golang automatically handles versioning of a database schema by applying a series of migrations supplied by the client. It uses features only from the database/sql package, so it tries to be driver independent. However, to track the version of the database, it is necessary to execute some SQL. I've made an effort to keep those queries simple, but if they don't work with your database, you may override them.
This package works by applying a series of migrations to a database. Once a migration is created, it should never be changed. Every time a database is opened with this package, all necessary migrations are executed in a single transaction. If any part of the process fails, an error is returned and the transaction is rolled back so that the database is left untouched.
The version of a database is defined as the number of migrations applied to it.
If you have Go installed, then migration
can be installed with go get
:
go get github.com/echlebek/migration
Documentation is available at godoc.org/github.com/echlebek/migration.
This is a fork of a project that was released with the caveat that it is unstable. That was 8 years ago, so it seems BurntSushi has been happy with the interface. :) This fork of the library should be considered more unstable.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.