mirror of
https://github.com/netbox-community/netbox.git
synced 2026-05-06 14:04:12 +08:00
This commit is contained in:
7
scripts/drop_database.sh
Executable file
7
scripts/drop_database.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
DB=${1:-netbox}
|
||||
|
||||
# Drop and re-create the database locally
|
||||
sudo -u postgres psql -c "drop database $DB"
|
||||
sudo -u postgres psql -c "create database $DB"
|
||||
11
scripts/load_database.sh
Executable file
11
scripts/load_database.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
DB=${2:-netbox}
|
||||
|
||||
# Drop and re-create the database locally
|
||||
sudo -u postgres psql -c "DROP DATABASE $DB"
|
||||
sudo -u postgres psql -c "CREATE DATABASE $DB"
|
||||
sudo -u postgres psql -c "GRANT CREATE ON DATABASE $DB TO $DB"
|
||||
|
||||
# Load tables from the production dump
|
||||
sudo -u postgres psql $DB < $1
|
||||
7
scripts/save_database.sh
Executable file
7
scripts/save_database.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
DB=${2:-netbox}
|
||||
|
||||
# Dump the database to a file
|
||||
sudo -u postgres pg_dump $DB > $1
|
||||
|
||||
Reference in New Issue
Block a user