Update Dev Notes

Jon Roeber 2024-01-15 02:59:10 +00:00
parent 9f33329496
commit 611b5be6cb

@ -1 +1,37 @@
Welcome to the Wiki.
## 20240114
PostGIS setup, PostgreSQL commands, ChirpStack integration
`apt install postgis`
`sudo -u postgres psql` (just psql -U postgres won't work)
`CREATE EXTENSION postgis;`
To select from user table:
`select * from public."user";` (select * from user doesn't work; shows the currently-logged in psql user instead?)
`CREATE DATABASE chirpstack_integration;`
`\c chirpstack_integration`
`CREATE ROLE chirpstack_integration PASSWORD '6XlFKCb2ygWCt'; (need to add WITH LOGIN next time)
`# GRANT ALL PRIVILEGES ON chirpstack_integration TO chirpstack_integration;` (doesn't work the way you think, see https://serverfault.com/a/198018)
`ALTER DATABASE chirpstack_integration OWNER TO chirpstack_integration;`
list roles:
`SELECT * FROM pg_roles;`
roles and users are different; roles cannot login by default and are not listed in pg_user (but all users are listed in pg_role)
`ALTER ROLE chirpstack_integration WITH LOGIN;` (since I didn't do login in the first place...best to just make a user)
schema for integration: https://github.com/chirpstack/chirpstack/blob/master/chirpstack/src/integration/postgresql/migrations/00000000000000_initial/up.sql
q about payload decoding https://forum.chirpstack.io/t/payload-decoding-in-postgres-integration/16356
the two interesting tables are event_up and event_integration