Skip to content

Commit

Permalink
Update database section on readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mrica-equinor committed Oct 28, 2024
1 parent 5b11d42 commit 1b32249
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,28 @@ Example:
);
```

## Database backup and cloning

You can use pg_dump to extract a PostgreSQL database into an sql file and psql to import the data into the target database from that file. Have the server running on pgAdmin and then execute the following commands.

Extract the entire database:

```
pg_dump -U Username -d postgres -h host_name_or_adress -p port -f ouput_file_name.slq
```

Extract specific tables:

```
pg_dump -U Username -d postgres -h host_name_or_adress -p port -t '"table_name"' -t '"second_table_name"' -f input_file_name.slq
```

Upload file information to new database:

```
psql U Username -d postgres -h host_name_or_adress -p port -f ouput_file_name.slq
```

## Formatting

### CSharpier
Expand Down

0 comments on commit 1b32249

Please sign in to comment.