eldr-io/hastl

Table name user is a reserved word (postgresql)

Closed this issue · 3 comments

hastl=> \d
            List of relations
 Schema |    Name     |   Type   | Owner 
--------+-------------+----------+-------
 public | user        | table    | hastl
 public | user_id_seq | sequence | hastl
(2 rows)

hastl=> select * from user;
 current_user 
--------------
 hastl
(1 row)

hastl=> select * from "user";
 id |     name      |         email         |          created_at           
----+---------------+-----------------------+-------------------------------
  1 | Alley Cats    | Alley.cats@invalid    | 2024-07-23 21:15:55.25558+02
  2 | Pigs in Space | pigs.in.space@invalid | 2024-07-24 10:32:23.08098+02
  3 | Dogs of War   | dogs.of.war@invalid   | 2024-07-24 10:32:36.920221+02
(3 rows)

Hey, I realise that this isn't ideal but it does not seem to cause an issue when running hastl? we could potentially rename the users model to app_user or something.

Any thoughts?

It indeed doesn't seem to affect hastl but the output

hastl=> select * from user;
 current_user 
--------------
 hastl
(1 row)

is a bit confusing when browsing the database with native PostgreSQL clients.

perhaps rename to guest ?

[but not a big thing™ and Haskell is refactorfriendly]

Good point! I might change it but working on some other bits just now to make the integration tests work and potentially some auth examples