CREATE TABLE gift_cards (
  id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
  code VARCHAR(64) UNIQUE NOT NULL,
  user_id VARCHAR (64) REFERENCES users(id) ON DELETE CASCADE,
  card_type VARCHAR(64) NOT NULL,
  origin VARCHAR(200),
  created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX gift_card_user_id_idx ON gift_cards(user_id);

ALTER TABLE users ADD COLUMN gifted_jamtracks INTEGER DEFAULT 0;
