CREATE TABLE machine_fingerprints (
  id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
  user_id VARCHAR(64) NOT NULL REFERENCES users(id) ON DELETE CASCADE,
  fingerprint VARCHAR(20000) NOT NULL UNIQUE,
  when_taken VARCHAR NOT NULL,
  print_type VARCHAR NOT NULL,
  remote_ip VARCHAR(1000) NOT NULL,
  jam_track_right_id BIGINT REFERENCES jam_track_rights(id) ON DELETE SET NULL,
  created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE jam_track_rights ADD COLUMN redeemed_and_fingerprinted BOOLEAN DEFAULT FALSE;