core: Remove updateSQLResource.sh, cleanup docs
authorShane Synan <digitalcircuit36939@gmail.com>
Wed, 13 Feb 2019 05:00:48 +0000 (00:00 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 13 Feb 2019 19:55:05 +0000 (20:55 +0100)
Remove updateSQLResource.sh as it's no longer needed.  `sql.qrc` is
now generated automatically as of commit
1a45f16a9734820fba42fe1db3f38dd1eee49df6

Update the README.md documentation in `src/core` to match.

Hooray!

src/core/SQL/README.md
src/core/SQL/updateSQLResource.sh [deleted file]
src/core/SQL/upgradeSchema.sh

index 13e905c..31e43f8 100644 (file)
@@ -17,10 +17,9 @@ All of the current schema version queries are stored at the top level of the
 backend subdirectory, with schema upgrade queries stored in
 `[backend]/version/##` folders.
 
 backend subdirectory, with schema upgrade queries stored in
 `[backend]/version/##` folders.
 
-At compile time, Qt reads [`sql.qrc`][file-qrc-sql] to know which queries to
-include.  This list can be automatically updated on Linux and macOS using
-[`updateSQLResource.sh`][file-sh-updateresource]; for now, on Windows you'll
-need to install some form of Bash.
+At compile time, the build system generates and reads a Qt resource file to
+know which queries to include.  For past Quassel contributors, this replaces
+the classic `sql.qrc` file and `updateSQLResource.sh` script.
 
 ## Managing the database outside of Quassel
 
 
 ## Managing the database outside of Quassel
 
@@ -106,33 +105,7 @@ For any table changes, you'll need to update the relevant
 >
 > Modify `PostgreSQL/migrate_write_ircserver.sql` to insert to new column
 
 >
 > Modify `PostgreSQL/migrate_write_ircserver.sql` to insert to new column
 
-5.  **Update the SQL resource file; re-run CMake if needed**
-
-**The easy way:**
-
-Run [`updateSQLResource.sh`][file-sh-updateresource] in this directory.
-
-**The manual way:**
-
-Add the new SQL queries to [`src/core/sql.qrc`][file-qrc-sql], update all
-changed existing files.
-
-> *Example: modifying the `ircserver` table to add column `test`*
->
-> Add the new upgrade scripts:
-> ```diff
-> +  <file>./SQL/SQLite/version/19/upgrade_000_alter_ircserver_add_test.sql</file>
-> +  <file>./SQL/PostgreSQL/version/18/upgrade_000_alter_ircserver_add_test.sql</file>
-> ```
->
-> Add/update non-upgrade scripts, if any:
-> ```diff
-> +  <file>./SQL/SQLite/update_buffer_persistent_channel.sql</file>
-> +  <file>./SQL/PostgreSQL/update_buffer_persistent_channel.sql</file>
-> +  [etc]
-> ```
-
-6.  **Update the migration logic in
+5.  **Update the migration logic in
 [`src/core/abstractsqlstorage.cpp`][file-cpp-abstract], and the storage
 backends [`postgresqlstorage.cpp`][file-cpp-postgres] and
 [`sqlitestorage.cpp`][file-cpp-sqlite]**
 [`src/core/abstractsqlstorage.cpp`][file-cpp-abstract], and the storage
 backends [`postgresqlstorage.cpp`][file-cpp-postgres] and
 [`sqlitestorage.cpp`][file-cpp-sqlite]**
@@ -155,7 +128,7 @@ may use different database representations of certain types.
 > [`postgresqlstorage.cpp`][file-cpp-postgres] to write to the new column from
 > the data in the migration object.
 
 > [`postgresqlstorage.cpp`][file-cpp-postgres] to write to the new column from
 > the data in the migration object.
 
-7.  **Update any affected queries in storage backends
+6.  **Update any affected queries in storage backends
 [`postgresqlstorage.cpp`][file-cpp-postgres] and
 [`sqlitestorage.cpp`][file-cpp-sqlite], and any related synchronized
 `src/common` classes.**
 [`postgresqlstorage.cpp`][file-cpp-postgres] and
 [`sqlitestorage.cpp`][file-cpp-sqlite], and any related synchronized
 `src/common` classes.**
@@ -184,7 +157,7 @@ may use different database representations of certain types.
 > +  query.bindValue(":test", server.test);                // New column 'test'
 > ```
 
 > +  query.bindValue(":test", server.test);                // New column 'test'
 > ```
 
-8.  **If protocol changed (*add a setting, etc*), add a new `Feature` flag**
+7.  **If protocol changed (*add a setting, etc*), add a new `Feature` flag**
 
 Newer clients need to detect when they're on an older core to disable the
 feature.  Use the `Feature` enum in [`quassel.h`][file-h-quassel].
 
 Newer clients need to detect when they're on an older core to disable the
 feature.  Use the `Feature` enum in [`quassel.h`][file-h-quassel].
@@ -195,7 +168,7 @@ In client-side code, test for a feature with...
 if (Client::isCoreFeatureEnabled(Quassel::Feature::FeatureName)) { ... }
 ```
 
 if (Client::isCoreFeatureEnabled(Quassel::Feature::FeatureName)) { ... }
 ```
 
-9.  **Test everything!  Upgrade, migrate, new setups, new client/old core,
+8.  **Test everything!  Upgrade, migrate, new setups, new client/old core,
 old client/new core, etc.**
 
 More specifically, you should try the following combinations, especially if you
 old client/new core, etc.**
 
 More specifically, you should try the following combinations, especially if you
@@ -270,8 +243,5 @@ Thank you for reading this guide and good luck with your changes!
 [file-h-abstract]: ../abstractsqlstorage.h
 [file-cpp-postgres]: ../postgresqlstorage.cpp
 [file-cpp-sqlite]: ../sqlitestorage.cpp
 [file-h-abstract]: ../abstractsqlstorage.h
 [file-cpp-postgres]: ../postgresqlstorage.cpp
 [file-cpp-sqlite]: ../sqlitestorage.cpp
-[file-sh-updateresource]: updateSQLResource.sh
 [file-sh-upgradeschema]: upgradeSchema.sh
 [file-sh-upgradeschema]: upgradeSchema.sh
-[file-qrc-sql]: ../sql.qrc
 [file-h-quassel]: ../../common/quassel.h
 [file-h-quassel]: ../../common/quassel.h
-
diff --git a/src/core/SQL/updateSQLResource.sh b/src/core/SQL/updateSQLResource.sh
deleted file mode 100755 (executable)
index dce3237..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2005-2019 by the Quassel Project - devel@quassel-irc.org
-# Licensed under GNU General Public License version 2, or (at your option)
-# version 3.
-#
-# Call this script whenever you move or rename the SQL files inside this
-# folder.  It'll regenerate 'sql.qrc' for you.  If it fails, you can manually
-# edit the file, too; just follow the pattern already in there.
-#
-# NOTE: In many cases you must upgrade the database schema version to make a
-# change, which includes adding upgrade scripts and modifying existing setup
-# queries.  See 'README.md' for details.
-
-set -u # Bash - fail on undefined variable
-
-# Path to the directory containing this script, resolving any symlinks, etc
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-# Name of the current directory
-SQL_DIR_NAME="${SCRIPT_DIR##*/}"
-# See https://stackoverflow.com/questions/1371261/get-current-directory-name-without-full-path-in-bash-script/1371283#1371283
-
-# SQL resource file (one directory up from this script)
-SQL_RES_FILE="$SCRIPT_DIR/../sql.qrc"
-
-# Add the Qt resource header, overwriting the existing file
-cat > "$SQL_RES_FILE" <<EOF
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
-EOF
-
-# In a subshell, use C locale to sort consistently regardless of
-# language, change to SQL directory so find output stays consistent,
-# then...
-# Find all files with a .sql ending...
-# | ...sort the results by version
-# | ...modify the beginning to change '.[...]' into '    <file>./SQL[...]' (add the directory path back)
-#   ...and modify the end to add '[...]</file>'
-# | ...append to the resource file.
-(export LC_ALL="C" ; cd "$SCRIPT_DIR" ; find . -name "*.sql" | sort --field-separator=/ --key=2,2 --key=4n | sed -e "s/^./    <file>.\/$SQL_DIR_NAME/g" -e "s/$/<\/file>/g" >> "$SQL_RES_FILE" )
-# Newer versions of sort support a "--version-sort" flag to naturally sort.
-# Unfortunately, some supported platforms don't yet have that version.
-# For now, "--field-separator=/ --key=2,2 --key=4n" does -almost- the same
-# thing (there's a difference when sorting periods versus underscores).
-#
-# Further explanation for sort command:
-# --field-separator=/
-#   > Separate fields by "/"
-# --key=2,2
-#   > Sort by the second field, i.e. "SQLite" or "Postgres"
-# --key=4n
-#   > Sort by the fourth field using numeric comparison
-#     (e.g. the "##" in "SQL/[database]/versions/##")
-
-# Add the Qt resource footer
-cat >> "$SQL_RES_FILE" <<EOF
-</qresource>
-</RCC>
-EOF
index 7ae2527..d31d613 100755 (executable)
@@ -9,8 +9,7 @@
 # whatever the current latest version is (e.g. 21 -> 22).
 #
 # NOTE: If you upgrade the database schema version, you must add upgrade
 # whatever the current latest version is (e.g. 21 -> 22).
 #
 # NOTE: If you upgrade the database schema version, you must add upgrade
-# scripts and modify the existing setup queries, then regenerate sql.qrc with
-# 'updateSQLResource'.  See 'README.md' for details.
+# scripts and modify the existing setup queries.  See 'README.md' for details.
 
 TARGET_DIR="$1"
 # If not specified, assume current directory
 
 TARGET_DIR="$1"
 # If not specified, assume current directory