Skip to content

Comments

[Coder] Schema update#306

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

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

Conversation

@ariga-bot
Copy link
Collaborator

Backward-incompatible change: renamed column public.users.hashed_password to password_hash (applications referencing the old column name will break).

…hed_password to password_hash (applications referencing the old column name will break).
@github-actions
Copy link
Contributor

atlas migrate lint on dirs/coder/migrations

Status Step Result
1 new migration file detected 20260211152540.sql
ERD and visual diff generated View Visualization
Analyze 20260211152540.sql
2 reports were found in analysis
Destructive changes detected
Dropping non-virtual column "hashed_password" (DS103)
Data dependent changes detected
Adding a non-nullable "bytea" column "password_hash" will fail in case table "users" is not empty (MF103)
Read the full linting report on Atlas Cloud

Comment on lines +1 to +2
-- Modify "users" table
ALTER TABLE "users" DROP COLUMN "hashed_password", ADD COLUMN "password_hash" bytea NOT NULL;
Copy link
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 "hashed_password" DS103

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

Suggested change
-- Modify "users" table
ALTER TABLE "users" DROP COLUMN "hashed_password", ADD COLUMN "password_hash" bytea NOT NULL;
-- atlas:txtar
-- checks/destructive.sql --
-- atlas:assert DS103
SELECT NOT EXISTS (SELECT 1 FROM "public"."users" WHERE "hashed_password" IS NOT NULL) AS "is_empty";
-- migration.sql --
-- Modify "users" table
ALTER TABLE "users" DROP COLUMN "hashed_password", ADD COLUMN "password_hash" bytea NOT NULL;

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