
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
github.com/rleess/goose-sqlite
goose is a database migration tool.
goose-sqlite is a fork of goose hacked (tastfully) to work with sqlite3. Support for other databases has been removed to minimize the overhead (in the spirit of sqlite). Everything else remains the same.
You can manage your database's evolution by creating incremental SQL or Go scripts.
$ go get bitbucket.org/dastels/goose-sqlite
This will install the goose-sqlite
binary to your $GOPATH/bin
directory.
goose-sqlite provides several commands to help manage your database schema.
Create a new migration script.
$ goose-sqlite create AddSomeColumns
$ goose: created db/migrations/20130106093224_AddSomeColumns.go
Edit the newly created script to define the behavior of your migration.
Apply all available migrations.
$ goose-sqlite up
$ goose: migrating db environment 'development', current version: 0, target: 3
$ OK 001_basics.sql
$ OK 002_next.sql
$ OK 003_and_again.go
Roll back a single migration from the current version.
$ goose-sqlite down
$ goose: migrating db environment 'development', current version: 3, target: 2
$ OK 003_and_again.go
Print the status of all migrations:
$ goose-sqlite status
$ goose: status for environment 'development'
$ Applied At Migration
$ =======================================
$ Sun Jan 6 11:25:03 2013 -- 001_basics.sql
$ Sun Jan 6 11:25:03 2013 -- 002_next.sql
$ Pending -- 003_and_again.go
goose-sqlite -h
provides more detailed info on each command.
goose-sqlite supports migrations written in SQL or in Go.
A sample SQL migration looks like:
:::sql
-- +goose Up
CREATE TABLE post (
id int NOT NULL,
title text,
body text,
PRIMARY KEY(id)
);
-- +goose Down
DROP TABLE post;
Notice the annotations in the comments. Any statements following -- +goose Up
will be executed as part of a forward migration, and any statements following -- +goose Down
will be executed as part of a rollback.
A sample Go migration looks like:
:::go
package migration_003
import (
"database/sql"
"fmt"
)
func Up(txn *sql.Tx) {
fmt.Println("Hello from migration_003 Up!")
}
func Down(txn *sql.Tx) {
fmt.Println("Hello from migration_003 Down!")
}
Up()
will be executed as part of a forward migration, and Down()
will be executed as part of a rollback.
A transaction is provided, rather than the DB instance directly, since goose-sqlite also needs to record the schema version within the same transaction. Each migration should run as a single transaction to ensure DB integrity, so it's good practice anyway.
goose-sqlite expects you to maintain a folder (typically called "db"), which contains the following:
You may use the -path
option to specify an alternate location for the folder containing your config and migrations.
A sample dbconf.yml looks like
development:
driver: sqlite
open: path/to/my/database
Here, development
specifies the name of the environment, and the driver
and open
elements are passed directly to database/sql to access the specified database.
You may include as many environments as you like, and you can use the -env
command line option to specify which one to use. goose-sqlite defaults to using an environment called development
.
goose-sqlite will expand environment variables in the open
element.
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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.