mirror of
https://github.com/coder/coder.git
synced 2025-07-08 11:39:50 +00:00
fix(coderd/database): migrate workspaces.last_used_at to timestamptz (#9699)
This commit is contained in:
2
coderd/database/dump.sql
generated
2
coderd/database/dump.sql
generated
@ -1046,7 +1046,7 @@ CREATE TABLE workspaces (
|
||||
name character varying(64) NOT NULL,
|
||||
autostart_schedule text,
|
||||
ttl bigint,
|
||||
last_used_at timestamp without time zone DEFAULT '0001-01-01 00:00:00'::timestamp without time zone NOT NULL,
|
||||
last_used_at timestamp with time zone DEFAULT '0001-01-01 00:00:00+00'::timestamp with time zone NOT NULL,
|
||||
dormant_at timestamp with time zone,
|
||||
deleting_at timestamp with time zone
|
||||
);
|
||||
|
@ -0,0 +1,6 @@
|
||||
ALTER TABLE ONLY workspaces
|
||||
ALTER COLUMN last_used_at
|
||||
SET DATA TYPE timestamp
|
||||
USING last_used_at::timestamptz AT TIME ZONE 'UTC',
|
||||
ALTER COLUMN last_used_at
|
||||
SET DEFAULT '0001-01-01 00:00:00'::timestamp;
|
@ -0,0 +1,6 @@
|
||||
ALTER TABLE ONLY workspaces
|
||||
ALTER COLUMN last_used_at
|
||||
SET DATA TYPE timestamptz
|
||||
USING last_used_at::timestamp AT TIME ZONE 'UTC',
|
||||
ALTER COLUMN last_used_at
|
||||
SET DEFAULT '0001-01-01 00:00:00+00:00'::timestamptz;
|
@ -1515,12 +1515,8 @@ func TestWorkspaceFilterManual(t *testing.T) {
|
||||
t.Run("LastUsed", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// nolint:gocritic // https://github.com/coder/coder/issues/9682
|
||||
db, ps := dbtestutil.NewDB(t, dbtestutil.WithTimezone("UTC"))
|
||||
client, _, api := coderdtest.NewWithAPI(t, &coderdtest.Options{
|
||||
IncludeProvisionerDaemon: true,
|
||||
Database: db,
|
||||
Pubsub: ps,
|
||||
})
|
||||
user := coderdtest.CreateFirstUser(t, client)
|
||||
authToken := uuid.NewString()
|
||||
|
Reference in New Issue
Block a user