freshyo/packages/db_helper_sqlite/drizzle/0004_staff_notif_creds.sql
2026-10-02 13:32:27 +05:30

14 lines
677 B
SQL

-- Migration: staff push-notification tokens.
-- One row per admin/staff device Expo push token, so notifications can be
-- broadcast to all admins (see admin.staffUser.savePushToken / sendAdminNotification).
CREATE TABLE IF NOT EXISTS `staff_notif_creds` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`token` text NOT NULL,
`added_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL,
`staff_user_id` integer NOT NULL,
`last_verified` text,
FOREIGN KEY (`staff_user_id`) REFERENCES `staff_users`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS `staff_notif_creds_token_unique` ON `staff_notif_creds` (`token`);