golang-migrate / migrate

Database migrations. CLI and Golang library.
Other
15.15k stars 1.39k forks source link

Support for libsql and Turso #1038

Open zachzafar opened 7 months ago

zachzafar commented 7 months ago

It would be nice to have drivers for Turso and libsql

Turso is an edge-hosted, distributed database that's based on libSQL , an open-source and open-contribution fork of SQLite. Connecting to a local instance is different from connecting to a remote instance so it may be the case that you need separate drivers to support this, documentaion here

avezina-ubik commented 7 months ago

Since I really don't know how long it's gonna take before PR #1042 will be merged, I made a Dockerfile so we can start using migrate with Turso sooner:

FROM ubuntu:22.04

RUN apt update && apt install -y build-essential git curl

RUN curl -O https://dl.google.com/go/go1.22.0.linux-amd64.tar.gz
RUN tar -xvzf go1.22.0.linux-amd64.tar.gz -C /usr/local
ENV GOROOT=/usr/local/go
ENV GOPATH=$HOME/go
ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH

RUN git clone https://github.com/avezina-ubik/migrate.git
RUN cd migrate/cmd/migrate && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o ../../cli/build/migrate -ldflags='-extldflags "-static"' -tags 'postgres mysql redshift cassandra spanner cockroachdb yugabytedb clickhouse mongodb sqlserver firebird neo4j pgx pgx5 rqlite libsql file go_bindata github github_ee bitbucket aws_s3 google_cloud_storage godoc_vfs gitlab' .
RUN cp migrate/cli/build/migrate /usr/local/bin/migrate