...
1# edge-sql
2
3A short, to the point summary of steps outlined in: https://docs.edge-infra.dev/edge/implementation/edge-sql/
4
5# Setting up a local database
6
7Steps to initialize a local postgres database with the edge schema and migrations, for use in local development or integration testing
8
9## Prereqs
10
111. A local postgres server with the pg_cron extension installed
12
13Create an alias or add `psql` to PATH. I used:
14
15`alias psql=/Applications/Postgres.app/Contents/Versions/latest/bin/psql`
16
17Create `edge` database and enable `pg_cron`:
18
19`psql --command='CREATE DATABASE edge'`
20`psql --command='CREATE EXTENSION IF NOT EXISTS pg_cron;' --dbname='edge'`
21
22Run `edge-sql` to run migrations and set up database:
23
24`SQL_CONNECTION_NAME=localhost SQL_PORT=5432 SQL_USER=postgres SQL_PASSWORD=postgres SQL_DB_NAME=edge TOP_LEVEL_PROJECT_ID=localhost bazel run //cmd/edge/edge-sql`
25
26Then, start API server following the steps in `pkg/edge/api/README.md` or point any other program with a database connection to localhost:5432
View as plain text