feat(package): migrator: something
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
8
test/package/migrator/util.sh
Normal file
8
test/package/migrator/util.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# columns(table)
|
||||
columns() {
|
||||
psql -Atc 'SELECT column_name
|
||||
FROM information_schema.columns
|
||||
WHERE table_name = '"${1};"
|
||||
}
|
||||
Reference in New Issue
Block a user