- Add DB index on bans.user_id to speed up per-request ban lookups (migration 0008) - Replace in-process rate limiter with Redis-backed implementation with in-memory fallback - Add Redis caching layer for site settings with TTL invalidation (migration 0009) - Add rate limiting to resetPassword to prevent token brute-force attacks - Update all rateLimit callers to await the now-async function - Flesh out RadioContests and RadioGiveaways models with title, description, prize, date, and winner columns - Update radio contest/giveaway pages to display new fields - Add tests for rate limiter (4 tests) and password-reset actions (3 tests) - Add REDIS_URL environment variable (optional, falls back to in-memory)
30 lines
1.6 KiB
SQL
30 lines
1.6 KiB
SQL
-- 0009_radio_contests_giveaways_columns.sql
|
|
-- Fills in the empty RadioContests and RadioGiveaways tables with meaningful
|
|
-- columns. These tables were created in migration 0004 with only id/timestamps.
|
|
|
|
ALTER TABLE `radio_contests`
|
|
ADD COLUMN `title` VARCHAR(255) NOT NULL AFTER `id`,
|
|
ADD COLUMN `description` TEXT NULL AFTER `title`,
|
|
ADD COLUMN `prize` VARCHAR(255) NULL AFTER `description`,
|
|
ADD COLUMN `start_date` TIMESTAMP(0) NULL AFTER `prize`,
|
|
ADD COLUMN `end_date` TIMESTAMP(0) NULL AFTER `start_date`,
|
|
ADD COLUMN `winner_id` BIGINT UNSIGNED NULL AFTER `end_date`,
|
|
ADD COLUMN `is_active` BOOLEAN NOT NULL DEFAULT true AFTER `winner_id`,
|
|
ADD COLUMN `created_by` BIGINT UNSIGNED NULL AFTER `is_active`,
|
|
MODIFY COLUMN `created_at` TIMESTAMP(0) NULL AFTER `created_by`,
|
|
MODIFY COLUMN `updated_at` TIMESTAMP(0) NULL AFTER `created_at`;
|
|
|
|
ALTER TABLE `radio_giveaways`
|
|
ADD COLUMN `title` VARCHAR(255) NOT NULL AFTER `id`,
|
|
ADD COLUMN `description` TEXT NULL AFTER `title`,
|
|
ADD COLUMN `prize` VARCHAR(255) NULL AFTER `description`,
|
|
ADD COLUMN `prize_amount` INT NOT NULL DEFAULT 0 AFTER `prize`,
|
|
ADD COLUMN `prize_currency` VARCHAR(50) NULL AFTER `prize_amount`,
|
|
ADD COLUMN `start_date` TIMESTAMP(0) NULL AFTER `prize_currency`,
|
|
ADD COLUMN `end_date` TIMESTAMP(0) NULL AFTER `start_date`,
|
|
ADD COLUMN `winner_id` BIGINT UNSIGNED NULL AFTER `end_date`,
|
|
ADD COLUMN `is_active` BOOLEAN NOT NULL DEFAULT true AFTER `winner_id`,
|
|
ADD COLUMN `created_by` BIGINT UNSIGNED NULL AFTER `is_active`,
|
|
MODIFY COLUMN `created_at` TIMESTAMP(0) NULL AFTER `created_by`,
|
|
MODIFY COLUMN `updated_at` TIMESTAMP(0) NULL AFTER `created_at`;
|