Files
Erupe/server/migrations/sql/0017_diva.sql
Houmgaor 9b0f735335 chore(merge): merge develop into main for 9.4.0 cycle
Brings 53 develop commits (i18n, Diva, campaign, guild invites, save
transfer, return/rookie guilds, hunting tournament, JSON quest/scenario
loaders, Ghidra-derived user binary parsing, and misc fixes) onto main
now that 9.3.2 has been tagged and released.

Resolves two overlap zones:

1. Migration number collision. Main shipped 0010_fix_zero_rasta_id and
   0011_fix_stale_boost_time in 9.3.2; develop had independently
   numbered 0010_campaign..0015_tournament. The migration runner keys
   applied versions by integer, so coexisting files with the same
   numeric prefix would silently skip each other. Develop's files have
   been renumbered to 0016..0021, leaving main's 0010/0011 intact. A
   schema_version rename script is required on any server that had
   already applied the old develop numbers (only frontier.mogapedia.fr
   at the time of this merge).

2. CHANGELOG.md. Develop's in-progress feature entries move into
   [Unreleased] with updated migration references; the [9.3.2] section
   is preserved verbatim.

main.go version string bumped to 9.4.0-dev to mark the new cycle.

Full test suite (go test -race ./...) passes.
2026-04-06 19:06:09 +02:00

45 lines
1.7 KiB
SQL

-- Diva Defense (United Defense) extended schema.
-- Adds bead selection, per-bead point accumulation, interception points,
-- and prize reward tables for personal and guild tracks.
-- Interception map data per guild (binary blob, existing column pattern).
ALTER TABLE guilds ADD COLUMN IF NOT EXISTS interception_maps bytea;
-- Per-character interception points keyed by quest file ID.
ALTER TABLE guild_characters ADD COLUMN IF NOT EXISTS interception_points jsonb NOT NULL DEFAULT '{}';
-- Prize reward table for personal and guild tracks.
CREATE TABLE IF NOT EXISTS diva_prizes (
id SERIAL PRIMARY KEY,
type VARCHAR(10) NOT NULL CHECK (type IN ('personal', 'guild')),
points_req INTEGER NOT NULL,
item_type INTEGER NOT NULL,
item_id INTEGER NOT NULL,
quantity INTEGER NOT NULL,
gr BOOLEAN NOT NULL DEFAULT false,
repeatable BOOLEAN NOT NULL DEFAULT false
);
-- Active bead types for the current Diva Defense event.
CREATE TABLE IF NOT EXISTS diva_beads (
id SERIAL PRIMARY KEY,
type INTEGER NOT NULL
);
-- Per-character bead slot assignments with expiry.
CREATE TABLE IF NOT EXISTS diva_beads_assignment (
id SERIAL PRIMARY KEY,
character_id INTEGER NOT NULL REFERENCES characters(id) ON DELETE CASCADE,
bead_index INTEGER NOT NULL,
expiry TIMESTAMPTZ NOT NULL
);
-- Per-character bead point accumulation log.
CREATE TABLE IF NOT EXISTS diva_beads_points (
id SERIAL PRIMARY KEY,
character_id INTEGER NOT NULL REFERENCES characters(id) ON DELETE CASCADE,
bead_index INTEGER NOT NULL,
points INTEGER NOT NULL,
timestamp TIMESTAMPTZ NOT NULL DEFAULT NOW()
);