Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migrations #20

Merged
merged 1 commit into from
May 27, 2024
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
3 changes: 3 additions & 0 deletions internal/assets/migrations/001_initial.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CREATE TABLE IF NOT EXISTS balances

CREATE INDEX IF NOT EXISTS balances_page_index ON balances (amount, updated_at) WHERE referred_by IS NOT NULL;

DROP TRIGGER IF EXISTS set_updated_at ON balances;
CREATE TRIGGER set_updated_at
BEFORE UPDATE
ON balances
Expand All @@ -31,6 +32,7 @@ CREATE TABLE IF NOT EXISTS referrals
ALTER TABLE balances ADD CONSTRAINT referred_by_fk FOREIGN KEY (referred_by) REFERENCES referrals (id);
CREATE INDEX IF NOT EXISTS referrals_nullifier_index ON referrals (nullifier);

DROP TYPE IF EXISTS event_status;
CREATE TYPE event_status AS ENUM ('open', 'fulfilled', 'claimed');

CREATE TABLE IF NOT EXISTS events
Expand All @@ -49,6 +51,7 @@ CREATE TABLE IF NOT EXISTS events

CREATE INDEX IF NOT EXISTS events_page_index ON events (nullifier, updated_at);

DROP TRIGGER IF EXISTS set_updated_at ON events;
CREATE TRIGGER set_updated_at
BEFORE UPDATE
ON events
Expand Down
Loading