#Database to rust structs [DIESEL]

8 messages · Page 1 of 1 (latest)

mellow abyss
#

diesel print-schema > schema.rs

daring imp
#

Thank you

daring imp
#
$ diesel print-schema
relation "bans" does not exist```
#

It gave me this error on my old database idk why. It is working just fine in my TS project using prisma

#
foobar=# \dt
                    List of relations
 Schema |            Name            | Type  |   Owner
--------+----------------------------+-------+-----------
 public | Bans                       | table | asdf_user
 ...
 public | User                       | table | asdf_user
 public | __diesel_schema_migrations | table | asdf_user
 public | _prisma_migrations         | table | asdf_user
(26 rows)


foobar=# \d Bans
Did not find any relation named "Bans".

foobar=# \d "Bans"
                                           Table "public.Bans"
   Column   |              Type              | Collation | Nullable |              Default
------------+--------------------------------+-----------+----------+------------------------------------
 id         | integer                        |           | not null | nextval('"Bans_id_seq"'::regclass)
 userId     | integer                        |           |          |
 createdAt  | timestamp(3) without time zone |           | not null | CURRENT_TIMESTAMP
 msDuration | integer                        |           | not null |
 reason     | text                           |           | not null |
 ip         | text                           |           | not null |
 fromId     | integer                        |           | not null |
Indexes:
    "Bans_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
    "Bans_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"(id) ON UPDATE CASCADE ON DELETE SET NULL
daring imp
#

gunzip < dump_2023-06-30_02_14_44.gz | docker exec -i your-db-container psql -U your-db-user -d your-db-name