feat(package): migrator: something

This commit is contained in:
2025-12-04 21:02:38 +00:00
parent dfa76b2a19
commit b786098867
12 changed files with 226 additions and 120 deletions

View File

@@ -39,6 +39,8 @@
} ''
${builtins.readFile self.legacyPackages.${system}.helpers.posix-shell.log}
test=${testDrv}
export HECTIC_LOG=trace
${builtins.readFile ./util.sh}
${builtins.readFile ./lauch.sh}
# success marker for Nix

View File

@@ -1,12 +1,21 @@
##!/bin/dash
#
#HECTIC_NAMESPACE=test-migration-list
#
#psql "$DATABASE_URL" 'CREATE TABLE profile (
# id INTEGER,
# username TEXT
#)'
#
#migrator --db-url "$DATABASE_URL" migrate to 20251104192425-add-info-to-profile
#
#exit 1
#!/bin/dash
HECTIC_NAMESPACE=test-migration-list
log notice "test case: ${WHITE}migration up"
psql "$DATABASE_URL" 'CREATE TABLE profile (
id INTEGER,
username TEXT
)'
if ! migrator --db-url "$DATABASE_URL" migrate to 20251104192425-add-info-to-profile; then
log error "test failed: ${WHITE}error on migration up"
exit 1
fi
log notice "$(columns profile)"
exit 1

View File

@@ -0,0 +1,8 @@
#!/bin/bash
# columns(table)
columns() {
psql -Atc 'SELECT column_name
FROM information_schema.columns
WHERE table_name = '"${1};"
}