diff options
Diffstat (limited to 'subversion/libsvn_wc/wc-metadata.sql')
-rw-r--r-- | subversion/libsvn_wc/wc-metadata.sql | 243 |
1 files changed, 10 insertions, 233 deletions
diff --git a/subversion/libsvn_wc/wc-metadata.sql b/subversion/libsvn_wc/wc-metadata.sql index f52df93f462a4..e34cf1422e60f 100644 --- a/subversion/libsvn_wc/wc-metadata.sql +++ b/subversion/libsvn_wc/wc-metadata.sql @@ -229,11 +229,6 @@ CREATE TABLE WC_LOCK ( ); -PRAGMA user_version = --- define: SVN_WC__VERSION -; - - /* ------------------------------------------------------------------------- */ /* The NODES table describes the way WORKING nodes are layered on top of @@ -279,7 +274,6 @@ PRAGMA user_version = An 'svn revert foo/bar' would remove the NODES of (2). */ --- STMT_CREATE_NODES CREATE TABLE NODES ( /* Working copy location related fields */ @@ -503,8 +497,6 @@ CREATE VIEW NODES_BASE AS SELECT * FROM nodes WHERE op_depth = 0; --- STMT_CREATE_NODES_TRIGGERS - CREATE TRIGGER nodes_insert_trigger AFTER INSERT ON nodes WHEN NEW.checksum IS NOT NULL @@ -532,8 +524,6 @@ BEGIN WHERE checksum = OLD.checksum; END; --- STMT_CREATE_EXTERNALS - CREATE TABLE EXTERNALS ( /* Working copy location related fields (like NODES)*/ @@ -572,6 +562,12 @@ CREATE UNIQUE INDEX I_EXTERNALS_DEFINED ON EXTERNALS (wc_id, def_local_relpath, local_relpath); + +PRAGMA user_version = +-- define: SVN_WC__VERSION +; + + /* ------------------------------------------------------------------------- */ /* This statement provides SQLite with the necessary information about our indexes to make better decisions in the query planner. @@ -630,208 +626,6 @@ INSERT INTO sqlite_stat1(tbl, idx, stat) VALUES ANALYZE sqlite_master; /* Loads sqlite_stat1 data for query optimizer */ /* ------------------------------------------------------------------------- */ -/* Format 20 introduces NODES and removes BASE_NODE and WORKING_NODE */ - --- STMT_UPGRADE_TO_20 - -UPDATE BASE_NODE SET checksum = (SELECT checksum FROM pristine - WHERE md5_checksum = BASE_NODE.checksum) -WHERE EXISTS (SELECT 1 FROM pristine WHERE md5_checksum = BASE_NODE.checksum); - -UPDATE WORKING_NODE SET checksum = (SELECT checksum FROM pristine - WHERE md5_checksum = WORKING_NODE.checksum) -WHERE EXISTS (SELECT 1 FROM pristine - WHERE md5_checksum = WORKING_NODE.checksum); - -INSERT INTO NODES ( - wc_id, local_relpath, op_depth, parent_relpath, - repos_id, repos_path, revision, - presence, depth, moved_here, moved_to, kind, - changed_revision, changed_date, changed_author, - checksum, properties, translated_size, last_mod_time, - dav_cache, symlink_target, file_external ) -SELECT wc_id, local_relpath, 0 /*op_depth*/, parent_relpath, - repos_id, repos_relpath, revnum, - presence, depth, NULL /*moved_here*/, NULL /*moved_to*/, kind, - changed_rev, changed_date, changed_author, - checksum, properties, translated_size, last_mod_time, - dav_cache, symlink_target, file_external -FROM BASE_NODE; -INSERT INTO NODES ( - wc_id, local_relpath, op_depth, parent_relpath, - repos_id, repos_path, revision, - presence, depth, moved_here, moved_to, kind, - changed_revision, changed_date, changed_author, - checksum, properties, translated_size, last_mod_time, - dav_cache, symlink_target, file_external ) -SELECT wc_id, local_relpath, 2 /*op_depth*/, parent_relpath, - copyfrom_repos_id, copyfrom_repos_path, copyfrom_revnum, - presence, depth, NULL /*moved_here*/, NULL /*moved_to*/, kind, - changed_rev, changed_date, changed_author, - checksum, properties, translated_size, last_mod_time, - NULL /*dav_cache*/, symlink_target, NULL /*file_external*/ -FROM WORKING_NODE; - -DROP TABLE BASE_NODE; -DROP TABLE WORKING_NODE; - -PRAGMA user_version = 20; - - -/* ------------------------------------------------------------------------- */ - -/* Format 21 involves no schema changes, it moves the tree conflict victim - information to victime nodes, rather than parents. */ - --- STMT_UPGRADE_TO_21 -PRAGMA user_version = 21; - -/* For format 21 bump code */ --- STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT -SELECT wc_id, local_relpath, tree_conflict_data -FROM actual_node -WHERE tree_conflict_data IS NOT NULL - -/* For format 21 bump code */ --- STMT_UPGRADE_21_ERASE_OLD_CONFLICTS -UPDATE actual_node SET tree_conflict_data = NULL - -/* ------------------------------------------------------------------------- */ - -/* Format 22 simply moves the tree conflict information from the conflict_data - column to the tree_conflict_data column. */ - --- STMT_UPGRADE_TO_22 -UPDATE actual_node SET tree_conflict_data = conflict_data; -UPDATE actual_node SET conflict_data = NULL; - -PRAGMA user_version = 22; - - -/* ------------------------------------------------------------------------- */ - -/* Format 23 involves no schema changes, it introduces multi-layer - op-depth processing for NODES. */ - --- STMT_UPGRADE_TO_23 -PRAGMA user_version = 23; - --- STMT_UPGRADE_23_HAS_WORKING_NODES -SELECT 1 FROM nodes WHERE op_depth > 0 -LIMIT 1 - -/* ------------------------------------------------------------------------- */ - -/* Format 24 involves no schema changes; it starts using the pristine - table's refcount column correctly. */ - --- STMT_UPGRADE_TO_24 -UPDATE pristine SET refcount = - (SELECT COUNT(*) FROM nodes - WHERE checksum = pristine.checksum /*OR checksum = pristine.md5_checksum*/); - -PRAGMA user_version = 24; - -/* ------------------------------------------------------------------------- */ - -/* Format 25 introduces the NODES_CURRENT view. */ - --- STMT_UPGRADE_TO_25 -DROP VIEW IF EXISTS NODES_CURRENT; -CREATE VIEW NODES_CURRENT AS - SELECT * FROM nodes - JOIN (SELECT wc_id, local_relpath, MAX(op_depth) AS op_depth FROM nodes - GROUP BY wc_id, local_relpath) AS filter - ON nodes.wc_id = filter.wc_id - AND nodes.local_relpath = filter.local_relpath - AND nodes.op_depth = filter.op_depth; - -PRAGMA user_version = 25; - -/* ------------------------------------------------------------------------- */ - -/* Format 26 introduces the NODES_BASE view. */ - --- STMT_UPGRADE_TO_26 -DROP VIEW IF EXISTS NODES_BASE; -CREATE VIEW NODES_BASE AS - SELECT * FROM nodes - WHERE op_depth = 0; - -PRAGMA user_version = 26; - -/* ------------------------------------------------------------------------- */ - -/* Format 27 involves no schema changes, it introduces stores - conflict files as relpaths rather than names in ACTUAL_NODE. */ - --- STMT_UPGRADE_TO_27 -PRAGMA user_version = 27; - -/* For format 27 bump code */ --- STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS -SELECT 1 FROM actual_node -WHERE NOT ((prop_reject IS NULL) AND (conflict_old IS NULL) - AND (conflict_new IS NULL) AND (conflict_working IS NULL) - AND (tree_conflict_data IS NULL)) -LIMIT 1 - - -/* ------------------------------------------------------------------------- */ - -/* Format 28 involves no schema changes, it only converts MD5 pristine - references to SHA1. */ - --- STMT_UPGRADE_TO_28 - -UPDATE NODES SET checksum = (SELECT checksum FROM pristine - WHERE md5_checksum = nodes.checksum) -WHERE EXISTS (SELECT 1 FROM pristine WHERE md5_checksum = nodes.checksum); - -PRAGMA user_version = 28; - -/* ------------------------------------------------------------------------- */ - -/* Format 29 introduces the EXTERNALS table (See STMT_CREATE_TRIGGERS) and - optimizes a few trigger definitions. ... */ - --- STMT_UPGRADE_TO_29 - -DROP TRIGGER IF EXISTS nodes_update_checksum_trigger; -DROP TRIGGER IF EXISTS nodes_insert_trigger; -DROP TRIGGER IF EXISTS nodes_delete_trigger; - -CREATE TRIGGER nodes_update_checksum_trigger -AFTER UPDATE OF checksum ON nodes -WHEN NEW.checksum IS NOT OLD.checksum - /* AND (NEW.checksum IS NOT NULL OR OLD.checksum IS NOT NULL) */ -BEGIN - UPDATE pristine SET refcount = refcount + 1 - WHERE checksum = NEW.checksum; - UPDATE pristine SET refcount = refcount - 1 - WHERE checksum = OLD.checksum; -END; - -CREATE TRIGGER nodes_insert_trigger -AFTER INSERT ON nodes -WHEN NEW.checksum IS NOT NULL -BEGIN - UPDATE pristine SET refcount = refcount + 1 - WHERE checksum = NEW.checksum; -END; - -CREATE TRIGGER nodes_delete_trigger -AFTER DELETE ON nodes -WHEN OLD.checksum IS NOT NULL -BEGIN - UPDATE pristine SET refcount = refcount - 1 - WHERE checksum = OLD.checksum; -END; - -PRAGMA user_version = 29; - -/* ------------------------------------------------------------------------- */ - /* Format 30 creates a new NODES index for move information, and a new PRISTINE index for the md5_checksum column. It also activates use of skel-based conflict storage -- see notes/wc-ng/conflict-storage-2.0. @@ -870,9 +664,9 @@ WHERE wc_id = ?1 and local_relpath = ?2 /* Format 31 adds the inherited_props column to the NODES table. C code then initializes the update/switch roots to make sure future updates fetch the inherited properties */ --- STMT_UPGRADE_TO_31_ALTER_TABLE +-- STMT_UPGRADE_TO_31 ALTER TABLE NODES ADD COLUMN inherited_props BLOB; --- STMT_UPGRADE_TO_31_FINALIZE + DROP INDEX IF EXISTS I_ACTUAL_CHANGELIST; DROP INDEX IF EXISTS I_EXTERNALS_PARENT; @@ -906,25 +700,8 @@ WHERE l.op_depth = 0 /* ------------------------------------------------------------------------- */ /* Format 32 .... */ --- STMT_UPGRADE_TO_32 - -/* Drop old index. ### Remove this part from the upgrade to 31 once bumped */ -DROP INDEX IF EXISTS I_ACTUAL_CHANGELIST; -DROP INDEX IF EXISTS I_EXTERNALS_PARENT; -CREATE INDEX I_EXTERNALS_PARENT ON EXTERNALS (wc_id, parent_relpath); - -DROP INDEX I_NODES_PARENT; -CREATE UNIQUE INDEX I_NODES_PARENT ON NODES (wc_id, parent_relpath, - local_relpath, op_depth); - -DROP INDEX I_ACTUAL_PARENT; -CREATE UNIQUE INDEX I_ACTUAL_PARENT ON ACTUAL_NODE (wc_id, parent_relpath, - local_relpath); - -/* ------------------------------------------------------------------------- */ - -/* Format YYY introduces new handling for conflict information. */ --- format: YYY +/* -- STMT_UPGRADE_TO_32 +PRAGMA user_version = 32; */ /* ------------------------------------------------------------------------- */ |