CREATE TABLE IF NOT EXISTS spells (
  id INTEGER GENERATED ALWAYS AS IDENTITY,
  name TEXT NOT NULL,
  school TEXT NOT NULL,
  level INTEGER NOT NULL,
  ritual BOOLEAN DEFAULT FALSE,
  casting_time_amount INTEGER NOT NULL,
  casting_time_unit TEXT NOT NULL,
  saving_throw TEXT[],
  attack_type TEXT,
  damage_type TEXT,
  conditions TEXT[],
  range_type TEXT NOT NULL,
  range_amount INTEGER,
  range_unit TEXT,
  area_type TEXT,
  area_amount INTEGER,
  area_unit TEXT,
  components_verbal BOOLEAN DEFAULT FALSE,
  components_somatic BOOLEAN DEFAULT FALSE,
  components_material BOOLEAN DEFAULT FALSE,
  components_materials_needed TEXT,
  components_materials_cost INTEGER,
  components_materials_consumed BOOLEAN DEFAULT FALSE,
  duration_type TEXT NOT NULL,
  duration_amount INTEGER,
  duration_unit TEXT,
  classes TEXT[] NOT NULL,
  sources TEXT[] NOT NULL,
  tags TEXT[],
  description JSONB NOT NULL
);