Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

PoC: https://github.com/ariga/atlas/issues/3006 #1

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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: 6 additions & 0 deletions migrations/20240730163630.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Rename an index from "posts_user_id_key" to "posts_user_id_idx"
ALTER INDEX "posts_user_id_key" RENAME TO "posts_user_id_idx";
Comment on lines +1 to +2
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the bug of ariga/atlas#3006

Suggested change
-- Rename an index from "posts_user_id_key" to "posts_user_id_idx"
ALTER INDEX "posts_user_id_key" RENAME TO "posts_user_id_idx";
-- Rename an index from "posts_user_id_key" to "posts_user_id_idx"
ALTER INDEX "app"."posts_user_id_key" RENAME TO "posts_user_id_idx";

-- Modify "users" table
ALTER TABLE "app"."users" DROP CONSTRAINT "users_email_key";
-- Create index "users_email_idx" to table: "users"
CREATE INDEX "users_email_idx" ON "app"."users" ("email");
3 changes: 2 additions & 1 deletion migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
h1:J0soLVPVa1IYLQEPWmUxLRjvKKUIjaFXuoAUFEn79xY=
h1:DnMLG9BSDyEdygG3xTk1fByLgvFcLqjeAEPMEs3Z0T4=
20240730163237.sql h1:87X9yZlFf+WKLXkMgTzCRiBi21ftDhc8NBc7M4w+GVA=
20240730163630.sql h1:0ZmCtxtrNnA1yjOEQjAjpyAZQRUqXKX29zYSpBPjmXc=
6 changes: 4 additions & 2 deletions schema.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ table "users" {
primary_key {
columns = [column.id]
}
unique "users_email_key" {
// Before: unique "users_email_key" {
index "users_email_idx" {
columns = [column.email]
}
}
Expand Down Expand Up @@ -44,7 +45,8 @@ table "posts" {
on_delete = CASCADE
on_update = NO_ACTION
}
index "posts_user_id_key" {
// Before: index "posts_user_id_key" {
index "posts_user_id_idx" {
columns = [column.user_id]
}
}