Skip to content

docs: remove permissions/owner dump flags, simplify DB creation #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 10, 2025

Conversation

RangerRick
Copy link
Contributor

@RangerRick RangerRick commented Jul 10, 2025

This pull request updates the backup and restore process for NetBox databases in the docs/netbox-enterprise/nbe-backups.md file. The changes focus on removing unnecessary database attributes during export and ensuring cleaner imports by filtering out specific SQL statements.

Updates to database export and import processes:

  • Export process simplification:

    • Removed options from the pg_dumpall command that excluded roles, privileges, and ownership during database export. ([docs/netbox-enterprise/nbe-backups.mdL129-L131](https://github.com/netboxlabs/console-docs/pull/157/files#diff-18aeb726b704282fe5d289a76aa42fdbc6ee6558b110b73ffcb9540e9b9377bcL129-L131))
  • Import process refinement:

    • Removed the check for CREATE DATABASE statements in the backup file and added a filter to exclude ALTER, CREATE, and DROP statements for DATABASE and ROLE during import. ([docs/netbox-enterprise/nbe-backups.mdL265-R262](https://github.com/netboxlabs/console-docs/pull/157/files#diff-18aeb726b704282fe5d289a76aa42fdbc6ee6558b110b73ffcb9540e9b9377bcL265-R262))

Code cleanup:

  • Removed redundant logic:
    • Eliminated unnecessary conditional checks related to database creation during the restore process. ([docs/netbox-enterprise/nbe-backups.mdL256](https://github.com/netboxlabs/console-docs/pull/157/files#diff-18aeb726b704282fe5d289a76aa42fdbc6ee6558b110b73ffcb9540e9b9377bcL256))

@RangerRick RangerRick requested review from weyrick and a team as code owners July 10, 2025 15:57
@RangerRick RangerRick requested a review from Copilot July 10, 2025 15:58
Copilot

This comment was marked as outdated.

RangerRick and others added 2 commits July 10, 2025 12:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@RangerRick RangerRick marked this pull request as draft July 10, 2025 16:13
@RangerRick RangerRick marked this pull request as ready for review July 10, 2025 16:27
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR streamlines the NetBox Enterprise backup script by dropping redundant pg_dumpall flags and overhauling the database-creation sequence.

  • Removed the --no-role-passwords, --no-privileges, and --no-owner options from the pg_dumpall invocation.
  • Replaced an in-script conditional for existing CREATE DATABASE statements with a grep -v filter.
  • Explicitly emits CREATE DATABASE statements for netbox and diode and removes redundant checks.
Comments suppressed due to low confidence (2)

docs/netbox-enterprise/nbe-backups.md:253

  • The script drops hydra in the loop but never recreates it; consider adding a CREATE DATABASE hydra step or removing hydra from the drop list if it's managed elsewhere.
  if [ "${DIODE_DEPLOYMENT_COUNT}" -gt 0 ]; then \

docs/netbox-enterprise/nbe-backups.md:259

  • The \connect netbox command was removed, so the subsequent SQL from the backup will run against the default database instead of netbox. Reintroduce a database context switch to ensure proper restoration.
  echo "CREATE DATABASE netbox WITH TEMPLATE = template0 ENCODING = 'UTF8';" && \

@RangerRick RangerRick merged commit 660aae7 into main Jul 10, 2025
2 checks passed
@RangerRick RangerRick deleted the fix/ENGHLP-198_backup_restore_ownership branch July 10, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants