-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: スキーマ変更 #39
Conversation
There was a problem hiding this 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
andupdated_at
columns to several tables, and adjust default values. - Extend domain model structs (
User
,UserChannels
,UserGuilds
) withCreatedAt
andUpdatedAt
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 forexpiration
is missing a value, resulting in invalid SQL. Specify a default (e.g.,CURRENT_TIMESTAMP
) or removeDEFAULT
.
"expiration" TIMESTAMP DEFAULT,
CreatedAt time.Time | ||
UpdatedAt time.Time |
There was a problem hiding this comment.
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.
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.
CreatedAt time.Time | ||
UpdatedAt time.Time |
There was a problem hiding this comment.
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.
CreatedAt time.Time | |
UpdatedAt time.Time | |
CreatedAt time.Time `db:"created_at"` | |
UpdatedAt time.Time `db:"updated_at"` |
Copilot uses AI. Check for mistakes.
CreatedAt time.Time | ||
UpdatedAt time.Time |
There was a problem hiding this comment.
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.
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.
* ギルドへの招待を追加 (#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>
* ギルドへの招待を追加 (#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>
* ギルドへの招待を追加 (#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>
概要
スキーマの修正、削除を行った。
変更点
issueにある通り
updated_at/created_atの追加に関しては、domain/modelの変更を行った。
行ったこと
✅
make migrate
での動作確認Issue
Closes: #38