re-add table with migration status

This commit is contained in:
pinpox
2025-08-03 13:45:33 +02:00
parent 35e5f4a42a
commit 87c8a4549b
2 changed files with 65 additions and 10 deletions

View File

@@ -21,12 +21,10 @@
roles.default.tags.all = { };
roles.default.extraModules = [
{
clan.core.postgresql.enable = true;
clan.core.postgresql.users.test = { };
clan.core.postgresql.databases.test.create.options.OWNER = "test";
clan.core.settings.directory = ./.;
}
];
};
@@ -36,15 +34,23 @@
# TODO: Broken. Use instead of importer after fixing.
# nodes.machine = { };
testScript = ''
start_all()
machine.wait_for_unit("postgresql")
testScript =
let
runpg = "runuser -u postgres -- /run/current-system/sw/bin/psql";
in
''
start_all()
machine.wait_for_unit("postgresql")
# Create a test table
machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql -c 'CREATE TABLE test (id serial PRIMARY KEY);' test")
machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql -d test -c 'INSERT INTO test DEFAULT VALUES;'")
machine.succeed("runuser -u postgres -- /run/current-system/sw/bin/psql -d test -c 'SELECT * FROM test;'")
'';
# Create a test table
machine.succeed("${runpg} -c 'CREATE TABLE test (id serial PRIMARY KEY);' test")
# Insert valuesn
machine.succeed("${runpg} -d test -c 'INSERT INTO test DEFAULT VALUES;'")
# Check that we can read them back
machine.succeed("${runpg} -d test -c 'SELECT * FROM test;'")
'';
};
};
}