-- Create Discord guild settings table for storing Discord guild configuration
CREATE TABLE IF NOT EXISTS discord.guild_settings (
    guild_id Numeric NOT NULL, -- Discord guild ID
    key TEXT NOT NULL,
    value JSONB NOT NULL DEFAULT '{}',
    PRIMARY KEY (guild_id, key)
);

-- Create index for faster lookups by guild_id
CREATE INDEX idx_discord_guild_settings_guild_id ON discord.guild_settings(guild_id);

-- Add comments for documentation
COMMENT ON TABLE discord.guild_settings IS 'Stores Discord guild-specific configuration settings as key-value pairs with JSONB values';
COMMENT ON COLUMN discord.guild_settings.guild_id IS 'Discord guild ID';
COMMENT ON COLUMN discord.guild_settings.key IS 'Setting key/name';
COMMENT ON COLUMN discord.guild_settings.value IS 'Setting value stored as JSONB for flexibility';
