Skip to content
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

refactor: Add tables and change table name #56

Merged
merged 5 commits into from
Mar 4, 2024

Conversation

Tatehito
Copy link
Collaborator

@Tatehito Tatehito commented Mar 1, 2024

以下のissue対応に必要なテーブルの作成、テーブル名の変更を行いました。

Self Check

  • I've confirmed All checks have passed on PR page. (You may leave this box unchecked due to long workflows.)
    • PR title follows Angular's commit message format.
      • PR title doesn't have WIP:.
    • All tests are passed.
      • Test command (e.g., yarn test) is passed.
      • Lint command (e.g., yarn lint) is passed.
  • I've reviewed my changes on PR's diff view.

@Tatehito Tatehito requested a review from ykit00 March 1, 2024 08:39
@Tatehito Tatehito self-assigned this Mar 1, 2024
courseId String
programId String
languageId String
problemVariables ProblemVariable[]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SQliteを利用している場合、Json型はサポート外のようでした。
https://www.prisma.io/docs/orm/overview/databases/sqlite#native-type-mapping-from-prisma-orm-to-sqlite
Int[] も使えなかったので、別テーブルにしてみました。

Copy link
Collaborator

Choose a reason for hiding this comment

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

JSON対応していないんですね👀

別テーブル化よさそうです!
一つの案としてString型でJSONを保持しておいて、使うときにパースするのもありかも? 今後時間はかかりそうですがJSON型がサポートされる可能性があるので、その際には移行も楽になるのかもなど思いました!

value Int
}

model UserCompletedProblem {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

口頭で話した際は UserCompletedProblems (旧UserSolvedProblem)は一旦作らないとしていましたが、migrationだけのPRをつくりやすい(消してしまうと進捗表示などの部分に手を入れる必要がある)ので残しています。
UserCompletedProblems が不要ということになれば、その際に対応したいと思います。

Comment on lines +52 to +54
userProblemSessionId Int

position Int
Copy link
Collaborator

Choose a reason for hiding this comment

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

シンプルな仕組みなので使うことはすくないかもしれませんが、この二つの複合キーでユニーク制約があると安心かもです!

@Tatehito Tatehito merged commit 8894857 into main Mar 4, 2024
5 checks passed
@Tatehito Tatehito deleted the refactor/create_table_and_change_table_name branch March 4, 2024 06:55
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.

2 participants