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 24, 2024
1 parent 5b11d42 commit a9e5537
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/adress -p 5432 -f ouput_file_name.slq
```

Extract specific tables:

```
pg_dump -U Username -d postgres -h host_name_or_adress -p 5432 -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/adress -p 5432 -f ouput_file_name.slq
```

## Formatting

### CSharpier
Expand Down

0 comments on commit a9e5537

Please sign in to comment.