fakenickels / reweb-graphql-fullstack

Type safe Postgres usage with Reason
MIT License
26 stars 1 forks source link

Running project #3

Open idkjs opened 4 years ago

idkjs commented 4 years ago

Tried running this project.

Got the following error:

❯ esy b dune exec backend/App.exe
File "repository/User.re", line 22, characters 45-57:
22 |   Database.runWithConnection(connection => [%pgsql.object connection("select * from app_users")])
                                                  ^^^^^^^^^^^^
Error: PG'OCaml PPX error: Could not make the connection host=localhost,
       port=6666, user=postgres, password=*****, database=postgres, error:
       PGOCaml_generic.Make(Thread).Error("PGOCaml: Could not connect to
       database")

I cant say docker is running. Running the docker command doesnt seem to work.

~/Github/reweb-graphql-fullstack master
❯ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                       PORTS               NAMES
b6fec4f1033d        postgres            "docker-entrypoint.s…"   4 minutes ago       Exited (130) 3 minutes ago                       mystifying_vaughan
2224634e31fc        postgres            "docker-entrypoint.s…"   5 minutes ago       Exited (0) 5 minutes ago                         nice_lamarr
9016e1a16093        alpine              "echo 'hello from al…"   6 minutes ago       Exited (0) 6 minutes ago                         wonderful_thompson
e94f99ac6441        postgres            "docker-entrypoint.s…"   6 minutes ago       Exited (0) 6 minutes ago                         vibrant_spence
34aeba8b650e        alpine              "ls -l"                  7 minutes ago       Exited (0) 7 minutes ago                         jolly_rosalind

~/Github/reweb-graphql-fullstack master
❯ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

~/Github/reweb-graphql-fullstack master
❯

I tried again without docker and get the same result. See -> https://github.com/idkjs/reweb-graphql-fullstack.

~/Github/reweb-graphql-fullstack master* 2m 41s
# pass --pwprompt to get a password prompt
❯ createuser --pwprompt reweb
Enter password for new role:
Enter it again:

# The -O indicates the user that will become the owner of the database.
~/Github/reweb-graphql-fullstack master* 10s
❯ createdb -Oreweb rewebdb

~/Github/reweb-graphql-fullstack master*
❯ psql -U reweb -W rewebdb
Password:
psql (12.2, server 12.1)
Type "help" for help.

rewebdb=>

Create A Table

Run psql -U reweb -W rewebdb -f sql/app_users_table.sql

Seed DB

Run psql -U reweb -W rewebdb -f sql/seed_users.sql

seeded

Keep getting that pgsql error in Users.re

Error: PG'OCaml PPX error: Postgres backend error: ERROR: 42P01: relation
       "app_users" does not exist: ERROR: 42P01: relation "app_users" does
       not exist(S: ERROR),(V: ERROR),(C: 42P01),(M: relation "app_users"
       does not exist),(P: 15),(F: parse_relation.c),(L: 1194),(R:
       parserOpenTable)

Thanks for any guidance.

fakenickels commented 4 years ago

Hey there! I'm sorry about the mess, I never finished the setup a bit. I had some WIP in my machine and I forgot to push! 😅

If you want to give it a try still try running this branch instead https://github.com/fakenickels/reweb-graphql-fullstack/tree/feature/postgres

fakenickels commented 4 years ago

The migrations code is not finished yet, but as you already created the table in the database it won't be necessary to get it running