fix(coderd/database): revert addition of v prefix to provisioner_daemons.api_version (#11403)

"Reverts" #11385 by adding an inverse migration.
This commit is contained in:
Cian Johnston 2024-01-04 11:47:31 +00:00 committed by GitHub
parent f9ebe8c719
commit 4355894b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 3 deletions

View File

@ -537,7 +537,7 @@ CREATE TABLE provisioner_daemons (
tags jsonb DEFAULT '{}'::jsonb NOT NULL,
last_seen_at timestamp with time zone,
version text DEFAULT ''::text NOT NULL,
api_version text DEFAULT 'v1.0'::text NOT NULL
api_version text DEFAULT '1.0'::text NOT NULL
);
COMMENT ON COLUMN provisioner_daemons.api_version IS 'The API version of the provisioner daemon';

View File

@ -0,0 +1,5 @@
ALTER TABLE ONLY provisioner_daemons
ALTER COLUMN api_version SET DEFAULT 'v1.0'::text;
UPDATE provisioner_daemons
SET api_version = 'v1.0'
WHERE api_version = '1.0';

View File

@ -0,0 +1,5 @@
ALTER TABLE ONLY provisioner_daemons
ALTER COLUMN api_version SET DEFAULT '1.0'::text;
UPDATE provisioner_daemons
SET api_version = '1.0'
WHERE api_version = 'v1.0';

View File

@ -3,6 +3,7 @@ package provisionersdk
import (
"context"
"errors"
"fmt"
"io"
"net"
"os"
@ -21,10 +22,16 @@ import (
)
const (
CurrentMajor = 1
CurrentMinor = 0
)
var (
SupportedMajors = []int{1}
// APIVersionCurrent is the current provisionerd API version.
// Breaking changes to the provisionerd API **MUST** increment
// the major version below.
APIVersionCurrent = "v1.0"
// CurrentMajor above.
APIVersionCurrent = fmt.Sprintf("%d.%d", CurrentMajor, CurrentMinor)
)
// ServeOptions are configurations to serve a provisioner.