mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-24 16:43:37 +01:00
- alliance recruiting default: change DEFAULT true → false in both 0001_init.sql and 0004_alliance_recruiting.sql; new alliances should not be open for recruitment by default (TestSetAllianceRecruiting) - guild_invites migration: add IF NOT EXISTS so re-running migrations on an existing DB does not fail with "relation already exists" (TestMigrateExistingDBWithoutSchemaVersion) - test character name: shorten "Idem_Rollover_Leader" (19 chars) to "IdemRollLeader" to fit the VARCHAR(15) constraint (TestRolloverDailyRP_Idempotent)
20 lines
896 B
SQL
20 lines
896 B
SQL
-- Dedicated table for guild-initiated scout invitations, separate from
|
|
-- player-initiated applications. This gives each invitation a real serial PK
|
|
-- so the client's InvitationID field can map to an actual database row
|
|
-- instead of being aliased to the character ID.
|
|
CREATE TABLE IF NOT EXISTS guild_invites (
|
|
id serial PRIMARY KEY,
|
|
guild_id integer REFERENCES guilds(id),
|
|
character_id integer REFERENCES characters(id),
|
|
actor_id integer REFERENCES characters(id),
|
|
created_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
|
|
-- Migrate any existing scout invitations from guild_applications.
|
|
INSERT INTO guild_invites (guild_id, character_id, actor_id, created_at)
|
|
SELECT guild_id, character_id, actor_id, COALESCE(created_at, now())
|
|
FROM guild_applications
|
|
WHERE application_type = 'invited';
|
|
|
|
DELETE FROM guild_applications WHERE application_type = 'invited';
|