Skip to content

[Coder] Schema update#368

Open
ariga-bot wants to merge 1 commit intomasterfrom
f/coder-605116
Open

[Coder] Schema update#368
ariga-bot wants to merge 1 commit intomasterfrom
f/coder-605116

Conversation

@ariga-bot
Copy link
Copy Markdown
Collaborator

Backward-incompatible change: renamed column public.workspaces.last_used_at to last_activity_at in the CREATE TABLE statement. Applications referencing last_used_at will break until updated.

…s.last_used_at to last_activity_at in the CREATE TABLE statement. Applications referencing last_used_at will break until updated.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

atlas migrate lint on dirs/coder/migrations

Status Step Result
1 new migration file detected 20260401153314.sql
ERD and visual diff generated View Visualization
Analyze 20260401153314.sql
1 reports were found in analysis
Destructive changes detected
Dropping non-virtual column "last_used_at" (DS103)
Read the full linting report on Atlas Cloud

Comment on lines +1 to +2
-- Modify "workspaces" table
ALTER TABLE "workspaces" DROP CONSTRAINT "workspaces_last_used_at_not_before_sentinel", ADD CONSTRAINT "workspaces_last_used_at_not_before_sentinel" CHECK (last_activity_at >= '0001-01-01 00:00:00'::timestamp without time zone), DROP COLUMN "last_used_at", ADD COLUMN "last_activity_at" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

destructive changes detected
Dropping non-virtual column "last_used_at" DS103

Add a pre-migration check to ensure column "last_used_at" is NULL before dropping it

Suggested change
-- Modify "workspaces" table
ALTER TABLE "workspaces" DROP CONSTRAINT "workspaces_last_used_at_not_before_sentinel", ADD CONSTRAINT "workspaces_last_used_at_not_before_sentinel" CHECK (last_activity_at >= '0001-01-01 00:00:00'::timestamp without time zone), DROP COLUMN "last_used_at", ADD COLUMN "last_activity_at" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00';
-- atlas:txtar
-- checks/destructive.sql --
-- atlas:assert DS103
SELECT NOT EXISTS (SELECT 1 FROM "public"."workspaces" WHERE "last_used_at" IS NOT NULL) AS "is_empty";
-- migration.sql --
-- Modify "workspaces" table
ALTER TABLE "workspaces" DROP CONSTRAINT "workspaces_last_used_at_not_before_sentinel", ADD CONSTRAINT "workspaces_last_used_at_not_before_sentinel" CHECK (last_activity_at >= '0001-01-01 00:00:00'::timestamp without time zone), DROP COLUMN "last_used_at", ADD COLUMN "last_activity_at" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00';

Ensure to run atlas migrate hash --dir "file://dirs/coder/migrations" after applying the suggested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant