<commit_before>/* wc-metadata.sql -- schema used in the wc-metadata SQLite database
 *     This is intended for use with SQLite 3
 *
 * ====================================================================
 * Copyright (c) 2008 CollabNet.  All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at http://subversion.tigris.org/license-1.html.
 * If newer versions of this license are posted there, you may use a
 * newer version instead, at your option.
 *
 * This software consists of voluntary contributions made by many
 * individuals.  For exact contribution history, see the revision
 * history and logs, available at http://subversion.tigris.org/.
 * ====================================================================
 */

/*
 * the KIND column in these tables has one of six values:
 *   DIRECTORY
 *   FILE
 *   SYMLINK
 *   (absent) DIRECTORY
 *   (absent) FILE
 *   (absent) SYMLINK
 */


/* ------------------------------------------------------------------------- */

CREATE TABLE REPOSITORY (
  id INTEGER PRIMARY KEY AUTOINCREMENT,

  /* the root URL of the repository */
  root  TEXT NOT NULL,

  /* the UUID of the repository */
  uuid  TEXT NOT NULL
  );


/* ------------------------------------------------------------------------- */

CREATE TABLE WCROOT (
  id  INTEGER PRIMARY KEY AUTOINCREMENT,

  /* absolute path in the local filesystem */
  local_abspath  TEXT NOT NULL
  );

CREATE UNIQUE INDEX I_LOCAL_ABSPATH ON WCROOT (local_abspath);


/* ------------------------------------------------------------------------- */

CREATE TABLE BASE_NODE (
  id  INTEGER PRIMARY KEY AUTOINCREMENT,

  /* the WCROOT that we are part of. NULL if the metadata is stored in
     {wcroot}/.svn/ */
  wc_id  INTEGER,

  /* relative path from wcroot. this will be "" for the wcroot. */
  local_relpath  TEXT NOT NULL,

  /* the repository this node is part of, and the relative path [to its
     root] within that repository.  these may be NULL, implying it should
     be derived from the parent and local_relpath.  non-NULL typically
     indicates a switched node. */
  repos_id  INTEGER,
  repos_relpath  TEXT,

  /* parent node. used to aggregate all child nodes of a given parent.
     NULL if this is the wcroot node. */
  parent_id  INTEGER,

  revnum  INTEGER NOT NULL,

  /* file/dir/special. none says this node is NOT present at this REV. */
  kind  INTEGER NOT NULL,

  /* if this node is a file, then the checksum and its translated size
     (given the properties on this file) are specified by the following
     two fields. */
  checksum  TEXT,
  translated_size  INTEGER,

  /* Information about the last change to this node */
  changed_rev  INTEGER NOT NULL,
  changed_date  INTEGER NOT NULL,  /* an APR date/time (usec since 1970) */
  changed_author  TEXT NOT NULL,

  /* NULL depth means "default" (typically svn_depth_infinity) */
  depth  INTEGER,

  /* ### Do we need this?  We've currently got various mod time APIs
     ### internal to libsvn_wc, but those might be used in answering some
     ### question which is better answered some other way. */
  last_mod_time  INTEGER,  /* an APR date/time (usec since 1970) */

  /* serialized skel of this node's properties. */
  properties  BLOB NOT NULL,

  /* this node is a directory, and all of its child nodes have not (yet)
     been created [for this revision number]. */
  incomplete_children  INTEGER
  );

CREATE UNIQUE INDEX I_PATH ON BASE_NODE (wc_id, local_relpath);
CREATE INDEX I_PARENT ON BASE_NODE (parent_id);


/* ------------------------------------------------------------------------- */

CREATE TABLE PRISTINE (
  /* ### the hash algorithm (MD5 or SHA-1) is encoded in this value */
  checksum  TEXT NOT NULL PRIMARY KEY,

  /* ### enumerated values specifying type of compression. NULL implies
     ### that no compression has been applied. */
  compression  INTEGER,

  /* ### used to verify the pristine file is "proper". NULL if unknown,
     ### and (thus) the pristine copy is incomplete/unusable. */
  size  INTEGER,

  refcount  INTEGER NOT NULL
  );


/* ------------------------------------------------------------------------- */

CREATE TABLE WORKING_NODE (
  id  INTEGER PRIMARY KEY AUTOINCREMENT, 

  /* specifies the location of this node in the local filesystem */
  wc_id  INTEGER,
  local_relpath  TEXT NOT NULL,

  /* parent's local_relpath for aggregating children of a given parent.
     this will be "" if the parent is the wcroot. */
  parent_relpath  TEXT NOT NULL,

  /* kind==none implies this node was deleted or moved (see moved_to).
     other kinds:
       if a BASE_NODE exists at the same local_relpath, then this is a
       replaced item (possibly copied or moved here), which implies the
       base node should be deleted first. */
  kind  INTEGER NOT NULL,

  /* Where this node was copied from. Set only on the root of the copy,
     and implied for all children. */
  copyfrom_repos_id  INTEGER,
  copyfrom_repos_path  TEXT,
  copyfrom_revnum  INTEGER,

  /* If this node was moved (rather than just copied), this specifies
     the local_relpath of the source of the move. */
  moved_from  TEXT,

  /* If this node was moved (rather than just deleted), this specifies
     where the node was moved to. */
  moved_to  TEXT,

  /* if this node was added-with-history AND is a file, then the checksum
     and its translated size (given the properties on this file) are
     specified by the following two fields. */
  checksum  TEXT,
  translated_size  INTEGER,

  /* if this node was added-with-history, then the following fields will
     be NOT NULL */
  changed_rev  INTEGER,
  changed_date  INTEGER,  /* an APR date/time (usec since 1970) */
  changed_author  TEXT,

  /* NULL depth means "default" (typically svn_depth_infinity) */
  depth  INTEGER,

  /* ### Do we need this?  We've currently got various mod time APIs
     ### internal to libsvn_wc, but those might be used in answering some
     ### question which is better answered some other way. */
  last_mod_time  INTEGER,  /* an APR date/time (usec since 1970) */

  /* serialized skel of this node's properties. */<commit_msg>Change the 'kind' and 'depth' columns in the wc-ng metadata schema to text values, partly for human readability, and partly for consistency with existing ways of persisting these values.<commit_after>/* wc-metadata.sql -- schema used in the wc-metadata SQLite database
 *     This is intended for use with SQLite 3
 *
 * ====================================================================
 * Copyright (c) 2008 CollabNet.  All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at http://subversion.tigris.org/license-1.html.
 * If newer versions of this license are posted there, you may use a
 * newer version instead, at your option.
 *
 * This software consists of voluntary contributions made by many
 * individuals.  For exact contribution history, see the revision
 * history and logs, available at http://subversion.tigris.org/.
 * ====================================================================
 */

/*
 * the KIND column in these tables has one of six values:
 *   DIRECTORY
 *   FILE
 *   SYMLINK
 *   (absent) DIRECTORY
 *   (absent) FILE
 *   (absent) SYMLINK
 */


/* ------------------------------------------------------------------------- */

CREATE TABLE REPOSITORY (
  id INTEGER PRIMARY KEY AUTOINCREMENT,

  /* the root URL of the repository */
  root  TEXT NOT NULL,

  /* the UUID of the repository */
  uuid  TEXT NOT NULL
  );


/* ------------------------------------------------------------------------- */

CREATE TABLE WCROOT (
  id  INTEGER PRIMARY KEY AUTOINCREMENT,

  /* absolute path in the local filesystem */
  local_abspath  TEXT NOT NULL
  );

CREATE UNIQUE INDEX I_LOCAL_ABSPATH ON WCROOT (local_abspath);


/* ------------------------------------------------------------------------- */

CREATE TABLE BASE_NODE (
  id  INTEGER PRIMARY KEY AUTOINCREMENT,

  /* the WCROOT that we are part of. NULL if the metadata is stored in
     {wcroot}/.svn/ */
  wc_id  INTEGER,

  /* relative path from wcroot. this will be "" for the wcroot. */
  local_relpath  TEXT NOT NULL,

  /* the repository this node is part of, and the relative path [to its
     root] within that repository.  these may be NULL, implying it should
     be derived from the parent and local_relpath.  non-NULL typically
     indicates a switched node. */
  repos_id  INTEGER,
  repos_relpath  TEXT,

  /* parent node. used to aggregate all child nodes of a given parent.
     NULL if this is the wcroot node. */
  parent_id  INTEGER,

  revnum  INTEGER NOT NULL,

  /* file/dir/special. none says this node is NOT present at this REV. */
  kind  TEXT NOT NULL,

  /* if this node is a file, then the checksum and its translated size
     (given the properties on this file) are specified by the following
     two fields. */
  checksum  TEXT,
  translated_size  INTEGER,

  /* Information about the last change to this node */
  changed_rev  INTEGER NOT NULL,
  changed_date  INTEGER NOT NULL,  /* an APR date/time (usec since 1970) */
  changed_author  TEXT NOT NULL,

  /* NULL depth means "default" (typically svn_depth_infinity) */
  depth  TEXT,

  /* ### Do we need this?  We've currently got various mod time APIs
     ### internal to libsvn_wc, but those might be used in answering some
     ### question which is better answered some other way. */
  last_mod_time  INTEGER,  /* an APR date/time (usec since 1970) */

  /* serialized skel of this node's properties. */
  properties  BLOB NOT NULL,

  /* this node is a directory, and all of its child nodes have not (yet)
     been created [for this revision number]. */
  incomplete_children  INTEGER
  );

CREATE UNIQUE INDEX I_PATH ON BASE_NODE (wc_id, local_relpath);
CREATE INDEX I_PARENT ON BASE_NODE (parent_id);


/* ------------------------------------------------------------------------- */

CREATE TABLE PRISTINE (
  /* ### the hash algorithm (MD5 or SHA-1) is encoded in this value */
  checksum  TEXT NOT NULL PRIMARY KEY,

  /* ### enumerated values specifying type of compression. NULL implies
     ### that no compression has been applied. */
  compression  INTEGER,

  /* ### used to verify the pristine file is "proper". NULL if unknown,
     ### and (thus) the pristine copy is incomplete/unusable. */
  size  INTEGER,

  refcount  INTEGER NOT NULL
  );


/* ------------------------------------------------------------------------- */

CREATE TABLE WORKING_NODE (
  id  INTEGER PRIMARY KEY AUTOINCREMENT, 

  /* specifies the location of this node in the local filesystem */
  wc_id  INTEGER,
  local_relpath  TEXT NOT NULL,

  /* parent's local_relpath for aggregating children of a given parent.
     this will be "" if the parent is the wcroot. */
  parent_relpath  TEXT NOT NULL,

  /* kind==none implies this node was deleted or moved (see moved_to).
     other kinds:
       if a BASE_NODE exists at the same local_relpath, then this is a
       replaced item (possibly copied or moved here), which implies the
       base node should be deleted first. */
  kind  TEXT NOT NULL,

  /* Where this node was copied from. Set only on the root of the copy,
     and implied for all children. */
  copyfrom_repos_id  INTEGER,
  copyfrom_repos_path  TEXT,
  copyfrom_revnum  INTEGER,

  /* If this node was moved (rather than just copied), this specifies
     the local_relpath of the source of the move. */
  moved_from  TEXT,

  /* If this node was moved (rather than just deleted), this specifies
     where the node was moved to. */
  moved_to  TEXT,

  /* if this node was added-with-history AND is a file, then the checksum
     and its translated size (given the properties on this file) are
     specified by the following two fields. */
  checksum  TEXT,
  translated_size  INTEGER,

  /* if this node was added-with-history, then the following fields will
     be NOT NULL */
  changed_rev  INTEGER,
  changed_date  INTEGER,  /* an APR date/time (usec since 1970) */
  changed_author  TEXT,

  /* NULL depth means "default" (typically svn_depth_infinity) */
  depth  TEXT,

  /* ### Do we need this?  We've currently got various mod time APIs
     ### internal to libsvn_wc, but those might be used in answering some
     ### question which is better answered some other way. */
  last_mod_time  INTEGER,  /* an APR date/time (usec since 1970) */

  /* serialized skel of this node's properties. */
{'fraction_non_alphanumeric': 0.14766369868410684, 'fraction_numerical': 0.003782207863840517, 'mean_word_length': 2.4554859787639534, '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': '1993105', 'n_tokens_mistral': 3660, 'n_tokens_neox': 3395, 'n_words': 1544}