create table achievements (
	name text not null,
	id integer,
	date text,
	completed integer,
	unique (name, id)
);

create index if not exists idx_achievements_name on achievements(name);
create index if not exists idx_achievements_composite on achievements(id, date, completed);

create table if not exists similar_pairs (
	name1 TEXT not null,
	name2 TEXT not null,
	matching_count INTEGER not null,
	total_achievements1 INTEGER not null,
	total_achievements2 INTEGER not null,
	similarity_percentage REAL not null,
    cutoff_date TEXT NOT NULL,
	last_updated TEXT not null default (datetime('now')),
	primary key (name1, name2)
);

create index if not exists idx_similar_pairs_name1 on similar_pairs(name1);
create index if not exists idx_similar_pairs_name2 on similar_pairs(name2);
