8000 feat: スキーマ変更 by kasatomorning · Pull Request #39 · comb19/chat_back · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: スキーマ変更 #39

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 2 commits into from
May 20, 2025
Merged

feat: スキーマ変更 #39

merged 2 commits into from
May 20, 2025

Conversation

kasatomorning
Copy link
Contributor
@kasatomorning kasatomorning commented May 20, 2025

概要

スキーマの修正、削除を行った。

変更点

issueにある通り
updated_at/created_atの追加に関しては、domain/modelの変更を行った。

行ったこと

make migrate での動作確認

Issue

Closes: #38

@kasatomorning kasatomorning self-assigned this May 20, 2025
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 updates the database schema to add timestamp tracking and removes the todos table, and aligns the Go domain models accordingly.

  • Remove obsolete todos table.
  • Add created_at and updated_at columns to several tables, and adjust default values.
  • Extend domain model structs (User, UserChannels, UserGuilds) with CreatedAt and UpdatedAt fields.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
db/schema.sql Dropped todos; added timestamp columns; adjusted expiration default
api/domain/model/user.go Imported time; added CreatedAt/UpdatedAt to User
api/domain/model/user_channels.go Imported time; added CreatedAt/UpdatedAt to UserChannels
api/domain/model/user_guilds.go Imported time; added CreatedAt/UpdatedAt to UserGuilds
Comments suppressed due to low confidence (2)

db/schema.sql:5

  • Trailing comma before closing parenthesis can cause SQL syntax errors; remove the comma after the last column definition in the users table.
"updated_at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

db/schema.sql:62

  • The DEFAULT clause for expiration is missing a value, resulting in invalid SQL. Specify a default (e.g., CURRENT_TIMESTAMP) or remove DEFAULT.
"expiration" TIMESTAMP DEFAULT,

Comment on lines +8 to +9
CreatedAt time.Time
UpdatedAt time.Time
Copy link
Preview
Copilot AI May 20, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding struct tags (e.g., db:"created_at" json:"created_at") to CreatedAt and UpdatedAt so field names map correctly to your database and JSON.

Suggested change
8000
CreatedAt time.Time
UpdatedAt time.Time
CreatedAt time.Time `db:"created_at" json:"created_at"`
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`

Copilot uses AI. Check for mistakes.

Comment on lines +8 to +9
CreatedAt time.Time
UpdatedAt time.Time
Copy link
Preview
Copilot AI May 20, 2025

Choose a reason for hiding this comment

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

[nitpick] Add struct tags for CreatedAt/UpdatedAt to ensure proper mapping between the Go struct and DB column names.

Suggested change
CreatedAt time.Time
UpdatedAt time.Time
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`

Copilot uses AI. Check for mistakes.

Comment on lines +8 to +9
CreatedAt time.Time
UpdatedAt time.Time
Copy link
Preview
Copilot AI May 20, 2025

Choose a reason for hiding this comment

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

[nitpick] Include struct tags on the new timestamp fields to keep serialization and database mapping consistent.

Suggested change
CreatedAt time.Time
UpdatedAt time.Time
CreatedAt time.Time `json:"created_at,omitempty" db:"created_at"`
UpdatedAt time.Time `json:"updated_at,omitempty" db:"updated_at"`

Copilot uses AI. Check for mistakes.

@keito0tada keito0tada merged commit 0d0b46a into develop May 20, 2025
kasatomorning added a commit that referenced this pull request May 20, 2025
* ギルドへの招待を追加 (#36)

* modify pr template

* ギルドへの招待を追加

* feat(delete_channel)

* feat: スキーマ変更 (#39)

* feat:スキーマ変更

* chore:スキーマファイルのsyntax errorを修正

---------

Co-authored-by: kasatomorning <9549356+kasatomorning@users.noreply.github.com>
keito0tada added a commit that referenced this pull request May 22, 2025
* ギルドへの招待を追加 (#36)

* modify pr template

* ギルドへの招待を追加

* feat(delete_channel)

* feat: スキーマ変更 (#39)

* feat:スキーマ変更

* chore:スキーマファイルのsyntax errorを修正

* CORSの設定を修正 (#42)

* corsの設定を修正

* invitationのtypoを修正

* invitationのレスポンスを修正

* persistenceの関数名の修正

* AuthorizationServiceを追加

* 余計なスラッシュを削除 (#46)

---------

Co-authored-by: kasatomorning <9549356+kasatomorning@users.noreply.github.com>
keito0tada added a commit that referenced this pull request May 22, 2025
* ギルドへの招待を追加 (#36)

* modify pr template

* ギルドへの招待を追加

* feat(delete_channel)

* feat: スキーマ変更 (#39)

* feat:スキーマ変更

* chore:スキーマファイルのsyntax errorを修正

* CORSの設定を修正 (#42)

* corsの設定を修正

* invitationのtypoを修正

* invitationのレスポンスを修正

* persistenceの関数名の修正

* AuthorizationServiceを追加

* 余計なスラッシュを削除 (#46)

* ギルドに参加してもチャンネルに参加できなかった問題を修正 (#48)

* チャンネルの権限を確認するサービスを導入

* ログのリファクタ

* メッセージの送受信の認可をserviceに変更

---------

Co-authored-by: kasatomorning <9549356+kasatomorning@users.noreply.github.com>
keito0tada added a commit that referenced this pull request May 24, 2025
* ギルドへの招待を追加 (#36)

* modify pr template

* ギルドへの招待を追加

* feat(delete_channel)

* feat: スキーマ変更 (#39)

* feat:スキーマ変更

* chore:スキーマファイルのsyntax errorを修正

* CORSの設定を修正 (#42)

* corsの設定を修正

* invitationのtypoを修正

* invitationのレスポンスを修正

* persistenceの関数名の修正

* AuthorizationServiceを追加

* 余計なスラッシュを削除 (#46)

* ギルドに参加してもチャンネルに参加できなかった問題を修正 (#48)

* チャンネルの権限を確認するサービスを導入

* ログのリファクタ

* メッセージの送受信の認可をserviceに変更

* テスト用dbを追加 (#50)

* .env.*を無視

* テスト環境を追加

* postgresのversionを固定

* ローカル環境の修正

---------

Co-authored-by: kasatomorning <9549356+kasatomorning@users.noreply.github.com>
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
0