Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions infrastructure/postgres/setup-analytics.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
set -euo pipefail

# NOTE!
# This setup is ran before core migrations. Therefore you CAN NOT refer to the tables or data in core.

# Configuration
: "${POSTGRES_HOST:=localhost}"
: "${POSTGRES_PORT:=5432}"
Expand Down Expand Up @@ -57,13 +60,6 @@ CREATE TABLE IF NOT EXISTS analytics.locations (
location_type TEXT NOT NULL
);

INSERT INTO analytics.locations (id, name, parent_id, location_type)
SELECT id, name, parent_id, location_type FROM app.locations
ON CONFLICT (id) DO UPDATE
SET name = EXCLUDED.name,
parent_id = EXCLUDED.parent_id,
location_type = EXCLUDED.location_type;

CREATE TABLE IF NOT EXISTS analytics.event_actions (
event_type text NOT NULL,
action_type TEXT NOT NULL,
Expand Down
Loading