Skip to content

Commit

Permalink
WIP refactor: update migration setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonribble committed Sep 6, 2024
1 parent e5cb7dd commit b3f358d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 38 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ This Rust project requires the following:

## Setup

1. Run `docker-compose up -d` to run Postgres in the background.

2. Declare the database URL, either by exporting it:
1. Declare the database URL, either by exporting it:

```
export DATABASE_URL="postgres://postgres:test@localhost/contacts"
export DATABASE_URL="sqlite:contacts.db"
```

or by making a `.env` file:
Expand All @@ -46,13 +44,10 @@ This Rust project requires the following:
Add a contact

```
cargo run -- John Test john@example.com 123-456-7890
cargo run create --first-name test --last-name last --email test@ttest.com --phone-number 123-231-1122
```

## Cleanup

To destroy the Postgres database, run:
To destroy the database, delete `contacts.db`

```
docker-compose down --volumes
```
Binary file added contacts.db-shm
Binary file not shown.
Binary file added contacts.db-wal
Binary file not shown.
10 changes: 0 additions & 10 deletions migrations/20240705045956_contacts.sql

This file was deleted.

10 changes: 10 additions & 0 deletions migrations/20240906201523_contacts.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Add migration script here
CREATE TABLE IF NOT EXISTS contacts
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
first_name TEXT NOT NULL,
last_name TEXT NOT NULL,
display_name TEXT NOT NULL,
email TEXT NOT NULL,
phone_number TEXT NOT NULL
);

0 comments on commit b3f358d

Please sign in to comment.