<commit_before>-- Add refreshTokens

CREATE TABLE refreshTokens (
  token BINARY(32) PRIMARY KEY,
  clientId BINARY(8) NOT NULL,
  INDEX tokens_client_id(clientId),
  FOREIGN KEY (clientId) REFERENCES clients(id) ON DELETE CASCADE,
  userId BINARY(16) NOT NULL,
  INDEX tokens_user_id(userId),
  email VARCHAR(256) NOT NULL,
  scope VARCHAR(256) NOT NULL,
  createdAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci;

-- Add expiresAt column for access tokens

ALTER TABLE tokens ADD COLUMN expiresAt TIMESTAMP NOT NULL;
UPDATE tokens SET expiresAt = DATE_ADD(CURRENT_TIMESTAMP, INTERVAL 2 WEEK);

-- Add offline column to codes

ALTER TABLE codes ADD COLUMN offline BOOLEAN NOT NULL DEFAULT FALSE;

UPDATE dbMetadata SET value = '6' WHERE name = 'schema-patch-level';<commit_msg>fix(db): Fix an old db patch to apply cleanly in local dev.<commit_after>-- Add refreshTokens

CREATE TABLE refreshTokens (
  token BINARY(32) PRIMARY KEY,
  clientId BINARY(8) NOT NULL,
  INDEX tokens_client_id(clientId),
  FOREIGN KEY (clientId) REFERENCES clients(id) ON DELETE CASCADE,
  userId BINARY(16) NOT NULL,
  INDEX tokens_user_id(userId),
  email VARCHAR(256) NOT NULL,
  scope VARCHAR(256) NOT NULL,
  createdAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci;

-- Add expiresAt column for access tokens

ALTER TABLE tokens ADD COLUMN expiresAt TIMESTAMP NOT NULL DEFAULT "1980-01-01 00:00:00";
UPDATE tokens SET expiresAt = DATE_ADD(CURRENT_TIMESTAMP, INTERVAL 2 WEEK);

-- Add offline column to codes

ALTER TABLE codes ADD COLUMN offline BOOLEAN NOT NULL DEFAULT FALSE;

UPDATE dbMetadata SET value = '6' WHERE name = 'schema-patch-level';
{'fraction_non_alphanumeric': 0.06864988558352403, 'fraction_numerical': 0.02517162471395881, 'mean_word_length': 5.072916666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7234107', 'n_tokens_mistral': 611, 'n_tokens_neox': 563, 'n_words': 207}