31 lines
2.0 KiB
SQL
31 lines
2.0 KiB
SQL
CREATE TABLE IF NOT EXISTS achievements (
|
|
id SERIAL PRIMARY KEY,
|
|
title VARCHAR(100) NOT NULL,
|
|
description TEXT,
|
|
icon VARCHAR(10) NOT NULL DEFAULT '🏆',
|
|
xp_reward INTEGER NOT NULL DEFAULT 100,
|
|
unlock_condition VARCHAR(100) NOT NULL UNIQUE
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS player_achievements (
|
|
id SERIAL PRIMARY KEY,
|
|
achievement_id INTEGER NOT NULL REFERENCES achievements(id) ON DELETE CASCADE UNIQUE,
|
|
earned_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
INSERT INTO achievements (title, description, icon, xp_reward, unlock_condition) VALUES
|
|
('Primeiro Passo', 'Registre sua primeira transação manual', '👣', 50, 'first_transaction'),
|
|
('Explorador de Extratos', 'Importe seu primeiro extrato', '📄', 100, 'first_import'),
|
|
('Meta Atingida!', 'Poupe 40% pela primeira vez', '🎯', 200, 'first_40pct'),
|
|
('Tri-Campeão', 'Poupe 40% por 3 meses seguidos', '🥇', 500, 'three_months_40pct'),
|
|
('Veleirista Econômico', 'Gaste menos de R$500 no Veleiro em um mês', '⛵', 150, 'veleiro_under_500'),
|
|
('Nível 5', 'Alcance o nível 5', '⭐', 100, 'level_5'),
|
|
('Nível 10', 'Alcance o nível 10', '🌟', 300, 'level_10'),
|
|
('Mestre das Categorias', 'Categorize 100 transações', '🗂️', 200, 'categorize_100'),
|
|
('Semana Perfeita', 'Importe extrato por 4 semanas seguidas', '📅', 250, 'four_weeks_import'),
|
|
('Guardião da Saúde', 'Registre gasto com Saúde/Insulina em 3 meses', '💉', 300, 'health_3months'),
|
|
('Mês Limpo', 'Todas as recorrências cobertas em um mês', '✨', 200, 'full_recurring_month')
|
|
ON CONFLICT DO NOTHING;
|
|
|
|
INSERT INTO schema_migrations (version) VALUES (7) ON CONFLICT DO NOTHING;
|