Skip to content

Commit 57e8367

Browse files
committed
migration: add migration functionality
Support the migration of bbolt db database to SQL databases (SQLITE/POSTGRES)
1 parent c48cae4 commit 57e8367

File tree

8 files changed

+2180
-4
lines changed

8 files changed

+2180
-4
lines changed

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ XARGS := xargs -L 1
2222

2323
VERSION_TAG = $(shell git describe --tags)
2424

25+
DEV_TAGS = kvdb_etcd kvdb_postgres kvdb_sqlite
26+
RELEASE_TAGS = $(DEV_TAGS)
27+
2528
BUILD_SYSTEM = darwin-amd64 \
29+
darwin-arm64 \
2630
linux-386 \
2731
linux-amd64 \
2832
linux-armv6 \
@@ -49,7 +53,7 @@ endif
4953
make_ldflags = $(2) -X $(PKG).Commit=$(COMMIT)
5054

5155
DEV_GCFLAGS := -gcflags "all=-N -l"
52-
LDFLAGS := -ldflags "$(call make_ldflags, ${tags}, -s -w)"
56+
LDFLAGS := -ldflags "$(call make_ldflags, $(DEV_TAGS), -s -w)"
5357
DEV_LDFLAGS := -ldflags "$(call make_ldflags, $(DEV_TAGS))"
5458

5559
# For the release, we want to remove the symbol table and debug information (-s)
@@ -83,7 +87,7 @@ build:
8387

8488
install:
8589
@$(call print, "Installing lndinit.")
86-
$(GOINSTALL) -tags="${tags}" $(LDFLAGS) $(PKG)
90+
$(GOINSTALL) -tags="$(DEV_TAGS)" $(LDFLAGS) $(PKG)
8791

8892
release-install:
8993
@$(call print, "Installing release lndinit.")
@@ -105,7 +109,7 @@ scratch: build
105109

106110
unit:
107111
@$(call print, "Running unit tests.")
108-
$(GOTEST) ./...
112+
$(GOTEST) -tags="$(DEV_TAGS)" ./...
109113

110114
fmt: $(GOIMPORTS_BIN)
111115
@$(call print, "Fixing imports.")
@@ -115,7 +119,7 @@ fmt: $(GOIMPORTS_BIN)
115119

116120
lint: docker-tools
117121
@$(call print, "Linting source.")
118-
$(DOCKER_TOOLS) golangci-lint run -v $(LINT_WORKERS)
122+
$(DOCKER_TOOLS) golangci-lint run -v --build-tags="$(DEV_TAGS)"$(LINT_WORKERS)
119123

120124
vendor:
121125
@$(call print, "Re-creating vendor directory.")

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ initialization, including seed and password generation.
1313
- [`store-configmap`](#store-configmap)
1414
- [`init-wallet`](#init-wallet)
1515
- [`wait-ready`](#wait-ready)
16+
- [`migrate-db`](#migrate-db)
1617
- [Example usage](#example-usage)
1718
- [Basic setup](#example-use-case-1-basic-setup)
1819
- [Kubernetes](#example-use-case-2-kubernetes)
@@ -64,6 +65,11 @@ No `lnd` needed, but seed will be in `lnd`-specific [`aezeed` format](https://gi
6465
`wait-ready` waits for `lnd` to be ready by connecting to `lnd`'s status RPC
6566
- Needs `lnd` to run, eventually
6667

68+
### migrate-db
69+
`migrate-db` migrates the content of one `lnd` database to another, for example
70+
from `bbolt` to Postgres. See [data migration guide](docs/data-migration.md) for
71+
more information.
72+
6773
---
6874

6975
## Example Usage

0 commit comments

Comments
 (0)