mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2026-07-18 06:35:13 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d2ba2eb5ae | |||
| 6a016d7a58 | |||
| d1d5445b1d | |||
| bd267cc280 | |||
| 53460242d8 | |||
| 01a00dd791 | |||
| 779f297c85 | |||
| 35a4c355fe | |||
| b0ae1aba54 | |||
| 57d75b1e13 |
3
.claude/.gitignore
vendored
Normal file
3
.claude/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*
|
||||
!.gitignore
|
||||
!settings.json
|
||||
10
.claude/settings.json
Normal file
10
.claude/settings.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"permissions": {
|
||||
"ask": [
|
||||
"Edit(CHANGELOG.md)",
|
||||
"Write(CHANGELOG.md)",
|
||||
"Edit(pyproject.toml)",
|
||||
"Write(pyproject.toml)"
|
||||
]
|
||||
}
|
||||
}
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,4 +2,5 @@ __pycache__
|
||||
artifacts/
|
||||
*.egg-info
|
||||
dist/
|
||||
build/
|
||||
build/
|
||||
.mcp.json
|
||||
|
||||
42
CHANGELOG.md
42
CHANGELOG.md
@@ -1,5 +1,47 @@
|
||||
# Changelog
|
||||
|
||||
## [3.1.2] - 2026-07-18
|
||||
|
||||
- Restore: the postgres *--empty* pre-clean also drops user-owned text
|
||||
search configurations and dictionaries (*pg_ts_config*, *pg_ts_dict*),
|
||||
so a schema shipping a custom dictionary (e.g. taiga's
|
||||
*english_stem_nostop*) no longer aborts the replay with "duplicate key
|
||||
value violates unique constraint pg_ts_dict_dictname_index" under
|
||||
ON_ERROR_STOP.
|
||||
- Tests: the string-assertion unit test for the pre-clean SQL is replaced
|
||||
by real scenario data in the e2e: the seeded schema contains an
|
||||
overloaded *f()/f(int)* pair and the nostop dictionary plus
|
||||
configuration, and the restored database is queried to prove each
|
||||
survives the backup, pre-clean and replay cycle exactly once.
|
||||
|
||||
## [3.1.1] - 2026-07-17
|
||||
|
||||
- Restore: the postgres *--empty* pre-clean drops functions and procedures
|
||||
by their identity signature (*pg_get_function_identity_arguments*), so a
|
||||
schema that overloads a function name (e.g. discourse) no longer aborts
|
||||
the replay with "function name is not unique" under ON_ERROR_STOP.
|
||||
Identifier quoting moves from the outer DROP format into each object
|
||||
branch, since the *name(args)* compound must not be quoted as a whole; a
|
||||
unit test pins the per-branch *%I* quoting so future branches cannot
|
||||
regress unquoted.
|
||||
|
||||
## [3.1.0] - 2026-07-15
|
||||
|
||||
- Restore: the postgres *--empty* pre-clean emits one DROP per object and
|
||||
runs them via *\gexec* instead of a single DO-block, so large schemas
|
||||
(e.g. gitlab) no longer exhaust *max_locks_per_transaction* in one
|
||||
transaction. It also drops user-owned non-public schemas, so dumps that
|
||||
CREATE SCHEMA (e.g. discourse's *discourse_functions*) no longer abort
|
||||
on the already-existing schema under ON_ERROR_STOP.
|
||||
- Backup: *--database-containers* and *--images-no-stop-required* are now
|
||||
optional and default to an empty list, so a pure file backup needs no
|
||||
dummy arguments; an empty stop whitelist keeps the conservative
|
||||
stop-all behavior.
|
||||
- Tests: new e2e test restores *--empty* against a fully populated
|
||||
database containing a non-public schema and every dropped object class.
|
||||
*make test* runs the three suites concurrently after a single
|
||||
clean+build; *E2E_TEST_PATTERN* runs an e2e subset.
|
||||
|
||||
## [3.0.0] - 2026-07-12
|
||||
|
||||
- Backup: *--images-no-stop-required* and *--images-no-backup-required* now
|
||||
|
||||
40
Makefile
40
Makefile
@@ -1,5 +1,6 @@
|
||||
.PHONY: install build \
|
||||
test-e2e test test-unit test-integration
|
||||
.PHONY: install build clean \
|
||||
test test-unit test-integration test-e2e \
|
||||
test-unit-run test-integration-run test-e2e-run
|
||||
|
||||
# Default python if no venv is active
|
||||
PY_DEFAULT ?= python3
|
||||
@@ -33,25 +34,32 @@ build:
|
||||
clean:
|
||||
git clean -fdX .
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Run E2E tests inside the container (Docker socket required)
|
||||
# ------------------------------------------------------------
|
||||
# E2E via isolated Docker-in-Docker (DinD)
|
||||
# - depends on local image build
|
||||
# - starts a DinD daemon container on a dedicated network
|
||||
# - loads the freshly built image into DinD
|
||||
# - runs the unittest suite inside a container that talks to DinD via DOCKER_HOST
|
||||
test-e2e: clean build
|
||||
@bash scripts/test-e2e.sh
|
||||
# clean + build run once and in order, then the three suites run concurrently
|
||||
# via -j3; the *-run targets carry no clean/build prereq so the sub-make cannot
|
||||
# race a second clean against build.
|
||||
test:
|
||||
@$(MAKE) clean
|
||||
@$(MAKE) build
|
||||
@$(MAKE) -j3 test-unit-run test-integration-run test-e2e-run
|
||||
|
||||
test: test-unit test-integration test-e2e
|
||||
test-unit: clean build test-unit-run
|
||||
|
||||
test-unit: clean build
|
||||
test-integration: clean build test-integration-run
|
||||
|
||||
test-e2e: clean build test-e2e-run
|
||||
|
||||
test-unit-run:
|
||||
@echo ">> Running unit tests"
|
||||
@docker run --rm -t $(IMAGE) \
|
||||
bash -lc 'python -m unittest discover -t . -s tests/unit -p "test_*.py" -v'
|
||||
|
||||
test-integration: clean build
|
||||
test-integration-run:
|
||||
@echo ">> Running integration tests"
|
||||
@docker run --rm -t $(IMAGE) \
|
||||
bash -lc 'python -m unittest discover -t . -s tests/integration -p "test_*.py" -v'
|
||||
bash -lc 'python -m unittest discover -t . -s tests/integration -p "test_*.py" -v'
|
||||
|
||||
# E2E via isolated Docker-in-Docker (DinD): starts a DinD daemon on a dedicated
|
||||
# network, loads the freshly built image into it, and runs tests/e2e inside a
|
||||
# container that talks to DinD via DOCKER_HOST.
|
||||
test-e2e-run:
|
||||
@bash scripts/test-e2e.sh
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "backup-docker-to-local"
|
||||
version = "3.0.0"
|
||||
version = "3.1.2"
|
||||
description = "Backup Docker volumes to local with rsync and optional DB dumps."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.9"
|
||||
|
||||
@@ -37,6 +37,9 @@ KEEP_ON_FAIL="${E2E_KEEP_ON_FAIL:-0}"
|
||||
KEEP_VOLUMES="${E2E_KEEP_VOLUMES:-0}"
|
||||
DEBUG_SHELL="${E2E_DEBUG_SHELL:-0}"
|
||||
|
||||
# Override to run a subset, e.g. E2E_TEST_PATTERN=test_e2e_postgres_empty_drop_hard.py
|
||||
TEST_PATTERN="${E2E_TEST_PATTERN:-test_*.py}"
|
||||
|
||||
FAILED=0
|
||||
TS="$(date +%Y%m%d%H%M%S)"
|
||||
|
||||
@@ -194,6 +197,7 @@ else
|
||||
docker run --rm \
|
||||
--network "${NET}" \
|
||||
-e DOCKER_HOST="${DIND_HOST_IN_NET}" \
|
||||
-e E2E_TEST_PATTERN="${TEST_PATTERN}" \
|
||||
-v "${DIND_VOL}:/var/lib/docker" \
|
||||
-v "${E2E_TMP_VOL}:/tmp" \
|
||||
"${IMG}" \
|
||||
@@ -209,7 +213,7 @@ else
|
||||
cat /proc/sys/kernel/random/uuid > /etc/machine-id
|
||||
fi
|
||||
|
||||
python -m unittest discover -t . -s tests/e2e -p "test_*.py" -v -f
|
||||
python -m unittest discover -t . -s tests/e2e -p "${E2E_TEST_PATTERN}" -v -f
|
||||
'
|
||||
rc=$?
|
||||
fi
|
||||
|
||||
@@ -42,13 +42,13 @@ def parse_args() -> argparse.Namespace:
|
||||
p.add_argument(
|
||||
"--database-containers",
|
||||
nargs="+",
|
||||
required=True,
|
||||
default=[],
|
||||
help="Container names treated as special instances for database backups",
|
||||
)
|
||||
p.add_argument(
|
||||
"--images-no-stop-required",
|
||||
nargs="+",
|
||||
required=True,
|
||||
default=[],
|
||||
help="Exact image references (repo:tag, incl. any registry prefix) whose containers must not be stopped during file backup",
|
||||
)
|
||||
p.add_argument(
|
||||
|
||||
@@ -53,12 +53,16 @@ def restore_postgres_sql(
|
||||
docker_env = {"PGPASSWORD": password}
|
||||
|
||||
if empty:
|
||||
# Owner-filtered: extension members (pg_trgm's set_limit) are superuser-owned; IF EXISTS absorbs CASCADE fallout.
|
||||
# Owner-filtered pre-clean emitted as one DROP per row and run via \gexec so each
|
||||
# executes as its own top-level statement: a single DO-block runs every DROP in one
|
||||
# transaction and exhausts max_locks_per_transaction on large schemas (e.g. gitlab).
|
||||
# Also drop user-owned non-public schemas so a dump that CREATE SCHEMAs (e.g.
|
||||
# discourse's discourse_functions) does not fail on an already-existing schema.
|
||||
# Extension members (pg_trgm's set_limit) are superuser-owned; IF EXISTS absorbs CASCADE fallout.
|
||||
drop_sql = r"""
|
||||
DO $$ DECLARE r RECORD;
|
||||
BEGIN
|
||||
FOR r IN (
|
||||
SELECT c.relname AS name,
|
||||
SELECT format('DROP %s IF EXISTS public.%s CASCADE', obj.type, obj.name)
|
||||
FROM (
|
||||
SELECT format('%I', c.relname) AS name,
|
||||
CASE c.relkind
|
||||
WHEN 'v' THEN 'VIEW'
|
||||
WHEN 'm' THEN 'MATERIALIZED VIEW'
|
||||
@@ -69,18 +73,20 @@ BEGIN
|
||||
WHERE n.nspname = 'public' AND c.relkind IN ('r', 'p', 'v', 'm', 'f')
|
||||
AND pg_get_userbyid(c.relowner) = current_user
|
||||
UNION ALL
|
||||
SELECT p.proname AS name,
|
||||
-- Overloaded functions share a proname; DROP needs the identity
|
||||
-- signature or psql aborts with "function name is not unique".
|
||||
SELECT format('%I(%s)', p.proname, pg_get_function_identity_arguments(p.oid)) AS name,
|
||||
CASE p.prokind WHEN 'p' THEN 'PROCEDURE' ELSE 'FUNCTION' END AS type
|
||||
FROM pg_proc p JOIN pg_namespace n ON n.oid = p.pronamespace
|
||||
WHERE n.nspname = 'public' AND p.prokind IN ('f', 'p', 'w')
|
||||
AND pg_get_userbyid(p.proowner) = current_user
|
||||
UNION ALL
|
||||
SELECT c.relname AS name, 'SEQUENCE' AS type
|
||||
SELECT format('%I', c.relname) AS name, 'SEQUENCE' AS type
|
||||
FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace
|
||||
WHERE n.nspname = 'public' AND c.relkind = 'S'
|
||||
AND pg_get_userbyid(c.relowner) = current_user
|
||||
UNION ALL
|
||||
SELECT t.typname AS name, 'TYPE' AS type
|
||||
SELECT format('%I', t.typname) AS name, 'TYPE' AS type
|
||||
FROM pg_type t JOIN pg_namespace n ON n.oid = t.typnamespace
|
||||
WHERE n.nspname = 'public'
|
||||
AND pg_get_userbyid(t.typowner) = current_user
|
||||
@@ -89,14 +95,28 @@ BEGIN
|
||||
SELECT 1 FROM pg_class c2
|
||||
WHERE c2.oid = t.typrelid AND c2.relkind = 'c')))
|
||||
UNION ALL
|
||||
SELECT col.collname AS name, 'COLLATION' AS type
|
||||
SELECT format('%I', col.collname) AS name, 'COLLATION' AS type
|
||||
FROM pg_collation col JOIN pg_namespace n ON n.oid = col.collnamespace
|
||||
WHERE n.nspname = 'public'
|
||||
AND pg_get_userbyid(col.collowner) = current_user
|
||||
) LOOP
|
||||
EXECUTE format('DROP %s IF EXISTS public.%I CASCADE', r.type, r.name);
|
||||
END LOOP;
|
||||
END $$;
|
||||
UNION ALL
|
||||
SELECT format('%I', ts.cfgname) AS name, 'TEXT SEARCH CONFIGURATION' AS type
|
||||
FROM pg_ts_config ts JOIN pg_namespace n ON n.oid = ts.cfgnamespace
|
||||
WHERE n.nspname = 'public'
|
||||
AND pg_get_userbyid(ts.cfgowner) = current_user
|
||||
UNION ALL
|
||||
SELECT format('%I', d.dictname) AS name, 'TEXT SEARCH DICTIONARY' AS type
|
||||
FROM pg_ts_dict d JOIN pg_namespace n ON n.oid = d.dictnamespace
|
||||
WHERE n.nspname = 'public'
|
||||
AND pg_get_userbyid(d.dictowner) = current_user
|
||||
) obj
|
||||
UNION ALL
|
||||
SELECT format('DROP SCHEMA IF EXISTS %I CASCADE', n.nspname)
|
||||
FROM pg_namespace n
|
||||
WHERE NOT starts_with(n.nspname, 'pg_')
|
||||
AND n.nspname NOT IN ('public', 'information_schema')
|
||||
AND pg_get_userbyid(n.nspowner) = current_user
|
||||
\gexec
|
||||
"""
|
||||
docker_exec(
|
||||
container,
|
||||
|
||||
186
tests/e2e/test_e2e_postgres_empty_drop_hard.py
Normal file
186
tests/e2e/test_e2e_postgres_empty_drop_hard.py
Normal file
@@ -0,0 +1,186 @@
|
||||
# tests/e2e/test_e2e_postgres_empty_drop_hard.py
|
||||
import unittest
|
||||
|
||||
from .helpers import (
|
||||
POSTGRES_IMAGE,
|
||||
POSTGRES_DATA_DIR,
|
||||
backup_run,
|
||||
cleanup_docker,
|
||||
create_minimal_compose_dir,
|
||||
ensure_empty_dir,
|
||||
latest_version_dir,
|
||||
require_docker,
|
||||
run,
|
||||
unique,
|
||||
wait_for_postgres,
|
||||
write_databases_csv,
|
||||
)
|
||||
|
||||
# The scenario the --empty pre-clean must survive: a non-public user schema
|
||||
# plus one object of every class the discovery SELECT enumerates. Restore
|
||||
# --empty runs against the still-populated DB (no wipe), so the pre-clean must
|
||||
# drop discourse_functions too or the dump's CREATE SCHEMA aborts the replay
|
||||
# under ON_ERROR_STOP; the old public-only DROP left it and broke discourse.
|
||||
# The f()/f(int) pair reproduces discourse's overload abort ("function name
|
||||
# is not unique") and english_stem_nostop reproduces taiga's text search
|
||||
# dictionary abort (duplicate pg_ts_dict_dictname_index).
|
||||
SCENARIO_SQL = (
|
||||
"CREATE SCHEMA discourse_functions;"
|
||||
"CREATE TABLE discourse_functions.helper (id int);"
|
||||
"INSERT INTO discourse_functions.helper VALUES (1);"
|
||||
"CREATE TABLE public.t (id int primary key, v text);"
|
||||
"INSERT INTO public.t VALUES (1, 'ok');"
|
||||
"CREATE VIEW public.t_view AS SELECT * FROM public.t;"
|
||||
"CREATE SEQUENCE public.s;"
|
||||
"CREATE TYPE public.mood AS ENUM ('ok', 'bad');"
|
||||
"CREATE FUNCTION public.f() RETURNS int LANGUAGE sql AS 'SELECT 1';"
|
||||
"CREATE FUNCTION public.f(i int) RETURNS int LANGUAGE sql AS 'SELECT i';"
|
||||
"CREATE COLLATION public.c (locale = 'C');"
|
||||
"CREATE TEXT SEARCH DICTIONARY public.english_stem_nostop"
|
||||
" (Template = snowball, Language = english);"
|
||||
"CREATE TEXT SEARCH CONFIGURATION public.english_nostop (COPY = english);"
|
||||
"ALTER TEXT SEARCH CONFIGURATION public.english_nostop"
|
||||
" ALTER MAPPING FOR asciiword WITH public.english_stem_nostop;"
|
||||
)
|
||||
|
||||
|
||||
class TestE2EPostgresEmptyDropHard(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
require_docker()
|
||||
cls.prefix = unique("baudolo-e2e-postgres-empty-drop-hard")
|
||||
cls.backups_dir = f"/tmp/{cls.prefix}/Backups"
|
||||
ensure_empty_dir(cls.backups_dir)
|
||||
cls.compose_dir = create_minimal_compose_dir(f"/tmp/{cls.prefix}")
|
||||
cls.repo_name = cls.prefix
|
||||
|
||||
cls.pg_container = f"{cls.prefix}-pg"
|
||||
cls.pg_volume = f"{cls.prefix}-pg-vol"
|
||||
cls.containers = [cls.pg_container]
|
||||
cls.volumes = [cls.pg_volume]
|
||||
|
||||
run(["docker", "volume", "create", cls.pg_volume])
|
||||
run(
|
||||
[
|
||||
"docker",
|
||||
"run",
|
||||
"-d",
|
||||
"--name",
|
||||
cls.pg_container,
|
||||
"-e",
|
||||
"POSTGRES_PASSWORD=pgpw",
|
||||
"-e",
|
||||
"POSTGRES_DB=appdb",
|
||||
"-e",
|
||||
"POSTGRES_USER=postgres",
|
||||
"-v",
|
||||
f"{cls.pg_volume}:{POSTGRES_DATA_DIR}",
|
||||
POSTGRES_IMAGE,
|
||||
]
|
||||
)
|
||||
wait_for_postgres(cls.pg_container, user="postgres", timeout_s=90)
|
||||
|
||||
run(
|
||||
[
|
||||
"docker",
|
||||
"exec",
|
||||
cls.pg_container,
|
||||
"sh",
|
||||
"-lc",
|
||||
f'psql -U postgres -d appdb -v ON_ERROR_STOP=1 -c "{SCENARIO_SQL}"',
|
||||
]
|
||||
)
|
||||
|
||||
cls.databases_csv = f"/tmp/{cls.prefix}/databases.csv"
|
||||
write_databases_csv(
|
||||
cls.databases_csv, [(cls.pg_container, "appdb", "postgres", "pgpw")]
|
||||
)
|
||||
backup_run(
|
||||
backups_dir=cls.backups_dir,
|
||||
repo_name=cls.repo_name,
|
||||
compose_dir=cls.compose_dir,
|
||||
databases_csv=cls.databases_csv,
|
||||
database_containers=[cls.pg_container],
|
||||
images_no_stop_required=[POSTGRES_IMAGE],
|
||||
)
|
||||
cls.hash, cls.version = latest_version_dir(cls.backups_dir, cls.repo_name)
|
||||
|
||||
# No wipe: restore --empty must pre-clean the fully-populated DB
|
||||
# (incl. the non-public schema) before replaying the dump.
|
||||
run(
|
||||
[
|
||||
"baudolo-restore",
|
||||
"postgres",
|
||||
cls.pg_volume,
|
||||
cls.hash,
|
||||
cls.version,
|
||||
"--backups-dir",
|
||||
cls.backups_dir,
|
||||
"--repo-name",
|
||||
cls.repo_name,
|
||||
"--container",
|
||||
cls.pg_container,
|
||||
"--db-name",
|
||||
"appdb",
|
||||
"--db-user",
|
||||
"postgres",
|
||||
"--db-password",
|
||||
"pgpw",
|
||||
"--empty",
|
||||
]
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls) -> None:
|
||||
cleanup_docker(containers=cls.containers, volumes=cls.volumes)
|
||||
|
||||
def _scalar(self, sql: str) -> str:
|
||||
p = run(
|
||||
[
|
||||
"docker",
|
||||
"exec",
|
||||
self.pg_container,
|
||||
"sh",
|
||||
"-lc",
|
||||
f'psql -U postgres -d appdb -t -A -c "{sql}"',
|
||||
]
|
||||
)
|
||||
return (p.stdout or "").strip()
|
||||
|
||||
def test_public_data_restored(self) -> None:
|
||||
self.assertEqual(self._scalar("SELECT v FROM public.t WHERE id=1;"), "ok")
|
||||
|
||||
def test_view_restored(self) -> None:
|
||||
self.assertEqual(self._scalar("SELECT count(*) FROM public.t_view;"), "1")
|
||||
|
||||
def test_non_public_schema_restored(self) -> None:
|
||||
self.assertEqual(
|
||||
self._scalar(
|
||||
"SELECT count(*) FROM pg_namespace WHERE nspname='discourse_functions';"
|
||||
),
|
||||
"1",
|
||||
)
|
||||
|
||||
def test_overloaded_functions_restored_once_each(self) -> None:
|
||||
self.assertEqual(
|
||||
self._scalar("SELECT count(*) FROM pg_proc WHERE proname='f';"), "2"
|
||||
)
|
||||
self.assertEqual(self._scalar("SELECT public.f(41) + public.f();"), "42")
|
||||
|
||||
def test_text_search_dictionary_restored_once(self) -> None:
|
||||
self.assertEqual(
|
||||
self._scalar(
|
||||
"SELECT count(*) FROM pg_ts_dict WHERE dictname='english_stem_nostop';"
|
||||
),
|
||||
"1",
|
||||
)
|
||||
self.assertEqual(
|
||||
self._scalar(
|
||||
"SELECT count(*) FROM pg_ts_config WHERE cfgname='english_nostop';"
|
||||
),
|
||||
"1",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,43 +0,0 @@
|
||||
"""The --empty pre-clean drop must cover every object class a dump can
|
||||
re-CREATE ahead of tables; a missed class aborts the replay under
|
||||
ON_ERROR_STOP (OpenProject's ICU collation public.versions_name did)."""
|
||||
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
from baudolo.restore.db import postgres
|
||||
|
||||
|
||||
class TestPostgresEmptyDrop(unittest.TestCase):
|
||||
def _drop_sql(self) -> str:
|
||||
with tempfile.NamedTemporaryFile(suffix=".sql") as fh:
|
||||
Path(fh.name).write_bytes(b"SELECT 1;\n")
|
||||
with mock.patch.object(postgres, "docker_exec") as run:
|
||||
postgres.restore_postgres_sql(
|
||||
container="c",
|
||||
db_name="db",
|
||||
user="u",
|
||||
password="p",
|
||||
sql_path=fh.name,
|
||||
empty=True,
|
||||
)
|
||||
first_call = run.call_args_list[0]
|
||||
return first_call.kwargs["stdin"].decode()
|
||||
|
||||
def test_drop_covers_collations(self) -> None:
|
||||
sql = self._drop_sql()
|
||||
self.assertIn("pg_collation", sql)
|
||||
self.assertIn("'COLLATION' AS type", sql)
|
||||
self.assertIn("pg_get_userbyid(col.collowner) = current_user", sql)
|
||||
|
||||
def test_drop_still_covers_the_other_classes(self) -> None:
|
||||
sql = self._drop_sql()
|
||||
for marker in ("pg_class", "pg_proc", "'SEQUENCE' AS type", "'TYPE' AS type"):
|
||||
self.assertIn(marker, sql)
|
||||
self.assertIn("DROP %s IF EXISTS public.%I CASCADE", sql)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user