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

chore(rename): rename controller table to controllers #2700

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions backend/controller/dal/internal/sql/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ INSERT INTO requests (origin, "key", source_addr)
VALUES ($1, $2, $3);

-- name: UpsertController :one
INSERT INTO controller (key, endpoint)
INSERT INTO controllers (key, endpoint)
VALUES ($1, $2)
ON CONFLICT (key) DO UPDATE SET state = 'live',
endpoint = $2,
Expand All @@ -206,7 +206,7 @@ RETURNING id;
-- name: KillStaleControllers :one
-- Mark any controller entries that haven't been updated recently as dead.
WITH matches AS (
UPDATE controller
UPDATE controllers
SET state = 'dead'
WHERE state <> 'dead' AND last_seen < (NOW() AT TIME ZONE 'utc') - sqlc.arg('timeout')::INTERVAL
RETURNING 1)
Expand All @@ -215,7 +215,7 @@ FROM matches;

-- name: GetActiveControllers :many
SELECT *
FROM controller c
FROM controllers c
WHERE c.state <> 'dead'
ORDER BY c.key;

Expand Down
6 changes: 3 additions & 3 deletions backend/controller/dal/internal/sql/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/controller/sql/databasetesting/devel.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func CreateForDevel(ctx context.Context, dsn string, recreate bool) (*stdsql.DB,
DELETE FROM leases
RETURNING 1
), deleted_controllers AS (
DELETE FROM controller
DELETE FROM controllers
RETURNING 1
), deleted_runners AS (
DELETE FROM runners
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- migrate:up

ALTER TABLE controller RENAME TO controllers;

-- migrate:down

Loading