Skip to content

ドメインモデル精査 #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 17, 2025
Merged

ドメインモデル精査 #174

merged 6 commits into from
Jul 17, 2025

Conversation

woodnx
Copy link
Member

@woodnx woodnx commented Jul 3, 2025

Fixes #112

@Atotti Atotti requested a review from Copilot July 3, 2025 14:09
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refines the domain model by migrating primary keys to UUIDs and restructuring the topping customization relations.

  • Switched orders and dons models to use UUID string IDs and renamed timestamp fields.
  • Introduced customizes and customize_prices models to replace the old toppings schema.
  • Added don_customizes join model but missing composite key and has a naming mismatch.
Comments suppressed due to low confidence (2)

packages/backend/prisma/schema.prisma:35

  • [nitpick] The field topping_id refers to the customizes model. Renaming it to customize_id would align the name with the related model and improve clarity.
  topping_id String @db.Uuid

packages/backend/prisma/schema.prisma:44

  • The @db.VarChar() attribute requires a length parameter (e.g., @db.VarChar(255)). Please specify the maximum length for this column to avoid schema generation errors.
  label            String             @db.VarChar()

Comment on lines +34 to +39
don_id String @id @db.Uuid
topping_id String @db.Uuid
amount Int // 負も取りうる (0がデフォルト量)

model options {
id Int @id @default(autoincrement())
label String @db.VarChar(255)
customize customizes @relation(fields: [topping_id], references: [id])
don dons @relation(fields: [don_id], references: [id])
Copy link
Preview

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

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

The don_customizes model defines don_id as the sole primary key, which prevents associating multiple customizations with the same don. Consider removing @id from don_id and adding a composite primary key: @@id([don_id, topping_id]).

Copilot uses AI. Check for mistakes.

@hikuohiku
Copy link
Collaborator

hikuohiku commented Jul 3, 2025

ERD

Copy link
Collaborator

@hikuohiku hikuohiku left a comment

Choose a reason for hiding this comment

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

コメントしたところ以外は良さそうです!

create_datetime DateTime @default(now())
update_datetime DateTime @updatedAt
order orders @relation(fields: [order_id], references: [id])
don_customizes don_customizes[]
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

stateを生やす

インデックス貼りたいですが、prisma schemaってindexも記載できるのでしたっけ?

}
model don_customizes {
don_id String @id @db.Uuid
topping_id String @db.Uuid
Copy link
Collaborator

Choose a reason for hiding this comment

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

customize_idですかね?

@hikuohiku
Copy link
Collaborator

seed作り直したいですね。
別タスク作っておきます

@hikuohiku
Copy link
Collaborator

作りました #176

@woodnx woodnx merged commit f2fb768 into main Jul 17, 2025
@woodnx woodnx deleted the woodnx/issue112 branch July 17, 2025 13:38
@hikuohiku hikuohiku mentioned this pull request Jul 17, 2025
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.

ドメインモデル精査
3 participants