Postgres Management

Things that occur outside of the typical application lifecycle, like migrations and user management.

Warning: This section is under construction


Some seeding techniques

\copy from CSV

Here’s a pretty rudimentary example, using psql to seed a Postgres table from a CSV file.


Connect to the database...


This is snippet uses neon as the host, but the host could easily be an AWS RDS instance, or something else.

Create a custom type/enum...

Create table...

  pokemon {
    INT id "NOT NULL"
    TEXT name "NOT NULL"
    pokemon_type type_1 "NOT NULL"
    pokemon_type type_2
    INT total "NOT NULL"
    INT hp "NOT NULL"
    INT attack "NOT NULL"
    INT defense "NOT NULL"
    INT sp_atk "NOT NULL"
    INT sp_def "NOT NULL"
    INT speed "NOT NULL"
    INT generation "NOT NULL"
    BOOLEAN legendary "NOT NULL"

Copy data from CSV...

Backup and Restore



User Management