feat(legacy): helpers: allow HECTIC_NAMESPACE be empty

This commit is contained in:
2025-11-16 16:56:26 +00:00
parent bb99ef9a8a
commit 00f05cc3db
8 changed files with 37 additions and 22 deletions

View File

@@ -3,6 +3,9 @@
# $out - nix derivation output
# $test - test and assertion file
HECTIC_NAMESPACE=test-laucher
export HECTIC_LOG=trace
test_derivation="$(basename "$test")"
test_name="${test_derivation#*-*-}"
@@ -61,6 +64,8 @@ log info "run test ${WHITE}${test_name}${NC}"
# run test
. "${test}/run.sh"
HECTIC_NAMESPACE=test-laucher
log info "finish test pipeline"
# success marker for Nix

View File

@@ -1,7 +1,8 @@
#
# first migration
#
#!/bin/dash
HECTIC_NAMESPACE=test-create-migration
log notice "case: ${WHITE}first migration"
if ! migrator create; then
log error "test failed: error on migration creation"
exit 1
@@ -17,10 +18,7 @@ if [ "$(find ./migration -maxdepth 1 -type f | wc -l)" -eq 0 ]; then
exit 1
fi
#
# next migration
#
log notice "case: ${WHITE}next migration"
if ! migrator create; then
log error "test failed: error on migration creation"
exit 1
@@ -31,10 +29,7 @@ if [ "$(find ./migration -maxdepth 1 -type f | wc -l)" -eq 1 ]; then
exit 1
fi
#
# migration with custom name
#
log notice "case: ${WHITE}migration with custom name"
if ! migrator create --name test; then
log error "test failed: error on migration creation"
exit 1
@@ -50,10 +45,7 @@ if ! find ./migration -maxdepth 1 -type f -name '*test.sql' \
log eror "test failed: migration have unexpected name"
fi
#
# migration with custom name that contains space
#
log notice "case: ${WHITE}migration with custom name that contains space"
if ! migrator create --name 'test name'; then
log error "test failed: error on migration creation"
exit 1

View File

@@ -1,5 +1,7 @@
#!/bin/dash
HECTIC_NAMESPACE=test-init-migrator
log info "hectic.migration table inheritance"
if ! migration_table_sql="$(migrator --inherits tablename --inherits 'table name' init --dry-run)"; then
log error "test failed: error on migration table init dry run"

View File

@@ -1,3 +1,7 @@
#!/bin/dash
HECTIC_NAMESPACE=test-migration-list
psql "$DATABASE_URL" 'CREATE TABLE profile (
id INTEGER,
username TEXT

View File

@@ -1 +1,5 @@
#!/bin/dash
HECTIC_NAMESPACE=test-migration-list
#migrator list

View File

@@ -1,3 +1,7 @@
#!/bin/dash
HECTIC_NAMESPACE=test-missing-psql
# remove psql from $PATH
dir=$(dirname -- "$(command -v psql)")
PATH=$(printf '%s' "$PATH" | awk -v RS=: -v ORS=: -v d="$dir" '$0!=d{print}')