From 3d956d43c2193813b82e798cd332743b4ef807b5 Mon Sep 17 00:00:00 2001 From: Daniel Arroyo Date: Sun, 5 Jul 2026 23:26:53 -0400 Subject: [PATCH] fix: split ALTER TABLE into separate ADD COLUMN statements in migration 0002 SQLite does not support adding multiple columns in a single ALTER TABLE statement. The previous migration tried to add 6 columns at once and caused a syntax error, crashing the service at startup. Bump VERSION 0.1.7 -> 0.1.8 --- Makefile | 2 +- internal/db/migrations/0002_nfs_structured.sql | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 90fc049..bf1d3de 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ BINARY=nasctl -VERSION?=0.1.7 +VERSION?=0.1.8 GO?=go LDFLAGS=-s -w -X github.com/darroyo/nasctl/internal/web.Version=$(VERSION) -X github.com/darroyo/nasctl/internal/web.Commit=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) BUILD_FLAGS=CGO_ENABLED=0 diff --git a/internal/db/migrations/0002_nfs_structured.sql b/internal/db/migrations/0002_nfs_structured.sql index 4d5b4ea..5805e05 100644 --- a/internal/db/migrations/0002_nfs_structured.sql +++ b/internal/db/migrations/0002_nfs_structured.sql @@ -1,9 +1,8 @@ -ALTER TABLE nfs_exports - ADD COLUMN read_only INTEGER NOT NULL DEFAULT 0, - ADD COLUMN async_ INTEGER NOT NULL DEFAULT 0, - ADD COLUMN root_squash INTEGER NOT NULL DEFAULT 1, - ADD COLUMN subtree_check INTEGER NOT NULL DEFAULT 0, - ADD COLUMN fsid INTEGER NOT NULL DEFAULT 0, - ADD COLUMN advanced TEXT NOT NULL DEFAULT '{}'; +ALTER TABLE nfs_exports ADD COLUMN read_only INTEGER NOT NULL DEFAULT 0; +ALTER TABLE nfs_exports ADD COLUMN async_ INTEGER NOT NULL DEFAULT 0; +ALTER TABLE nfs_exports ADD COLUMN root_squash INTEGER NOT NULL DEFAULT 1; +ALTER TABLE nfs_exports ADD COLUMN subtree_check INTEGER NOT NULL DEFAULT 0; +ALTER TABLE nfs_exports ADD COLUMN fsid INTEGER NOT NULL DEFAULT 0; +ALTER TABLE nfs_exports ADD COLUMN advanced TEXT NOT NULL DEFAULT '{}'; CREATE INDEX IF NOT EXISTS idx_nfs_exports_fsid ON nfs_exports(fsid);