汎用 PUSH 通知のサブスクリプションとメッセージログを管理する2テーブルです。
PUSH 通知のサブスクリプション(汎用)テーブルです。
| カラム | 型 | NULL | デフォルト | 説明 |
|---|
id | text | NO | — | 主キー(UUID) |
userId | text | NO | — | ユーザー ID |
userType | text | NO | — | ユーザー種別(‘shop’ | ‘customer’) |
endpoint | text | NO | — | Push エンドポイント URL(ユニーク) |
p256dh | text | NO | — | 公開鍵(P-256 DH) |
auth | text | NO | — | 認証シークレット |
deviceName | text | YES | — | デバイス名 |
settings | jsonb | YES | — | 通知設定 |
shopId | text | YES | — | 店舗 ID(店舗ユーザーの場合) |
isActive | boolean | NO | true | アクティブ状態 |
createdAt | timestamptz(3) | NO | NOW() | 作成日時 |
updatedAt | timestamptz(3) | NO | NOW() | 更新日時 |
| 名前 | カラム | 種別 |
|---|
| — | endpoint | UNIQUE |
push_subscription_userId_idx | userId | INDEX |
push_subscription_shopId_idx | shopId | INDEX |
push_subscription_userId_isActive_idx | userId, isActive | INDEX(複合) |
PUSH 通知の送信ログと予約を管理するテーブルです。
| カラム | 型 | NULL | デフォルト | 説明 |
|---|
id | text | NO | — | 主キー(UUID) |
targetUserId | text | NO | — | 対象ユーザー ID |
targetType | text | NO | — | 対象種別(‘shop’ | ‘customer’) |
targetShopId | text | YES | — | 対象店舗 ID |
title | text | NO | — | 通知タイトル |
body | text | NO | — | 通知本文 |
url | text | YES | — | クリック先 URL |
priority | text | NO | 'normal' | 優先度(‘normal’ | ‘high’) |
scheduledAt | timestamptz(3) | NO | — | 送信予定日時 |
sendStatus | integer | NO | 0 | 送信ステータス(0:未送信, 1:送信済み, 2:失敗) |
sentAt | timestamptz(3) | YES | — | 実際の送信日時 |
resultStatus | text | YES | — | 送信結果ステータス |
resultMessage | text | YES | — | 送信結果メッセージ |
createdBy | text | NO | — | 作成者 ID |
createdAt | timestamptz(3) | NO | NOW() | 作成日時 |
updatedAt | timestamptz(3) | NO | NOW() | 更新日時 |
| 名前 | カラム | 種別 |
|---|
push_message_sendStatus_scheduledAt_idx | sendStatus, scheduledAt | INDEX(複合) |
push_message_targetUserId_idx | targetUserId | INDEX |
push_message_targetShopId_idx | targetShopId | INDEX |
push_message_createdBy_idx | createdBy | INDEX |