sorarebuddy/model/sql/fixture.sql

19 lines
499 B
SQL

-- name: CreateOrUpdateFixtures :batchexec
INSERT INTO fixtures (slug, display_name, state, start_date, end_date, game_week)
VALUES ($1, $2, $3, $4, $5, $6)
ON CONFLICT (slug) DO UPDATE
SET display_name = $2, state = $3, start_date = $4, end_date = $5, game_week = $6;
-- name: GetFixtureBySlug :one
SELECT * FROM fixtures WHERE slug = $1;
-- name: GetFixtureByGameWeek :one
SELECT * FROM fixtures WHERE game_week = $1;
-- name: GetAllFixtures :many
SELECT * FROM fixtures;