summaryrefslogtreecommitdiff
path: root/docs/Dealing-with-SQL-files.md
diff options
context:
space:
mode:
authorYehonal <yehonal.azeroth@gmail.com>2019-02-17 21:34:28 +0100
committerYehonal <yehonal.azeroth@gmail.com>2019-02-17 21:34:28 +0100
commita3d359e1cc4f40328f898653a5cc3b9711a522e6 (patch)
tree48d879cbdbf5e78a72ca686912ca4ac361c929c7 /docs/Dealing-with-SQL-files.md
parentb781501462339649eac45d9d54f8dbbfb11a32db (diff)
downloadwiki-a3d359e1cc4f40328f898653a5cc3b9711a522e6.tar.gz
wiki-a3d359e1cc4f40328f898653a5cc3b9711a522e6.tar.bz2
wiki-a3d359e1cc4f40328f898653a5cc3b9711a522e6.zip
Import all wiki page from old wiki (links to fix)
Diffstat (limited to 'docs/Dealing-with-SQL-files.md')
-rw-r--r--docs/Dealing-with-SQL-files.md35
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/Dealing-with-SQL-files.md b/docs/Dealing-with-SQL-files.md
new file mode 100644
index 0000000..8efef40
--- /dev/null
+++ b/docs/Dealing-with-SQL-files.md
@@ -0,0 +1,35 @@
+## SQL Format
+
+If you are not confident with the SQL language, we suggest to read [this tutorial](http://www.w3schools.com/sql/default.asp) before starting.
+
+Also remember to:
+
+- always use [UPDATE](http://www.w3schools.com/sql/sql_update.asp) in order to change the value of fields of **existing rows**
+
+- use [INSERT](http://www.w3schools.com/sql/sql_insert.asp) in order to insert **new rows only**, but be sure to avoid import errors using [DELETE](http://www.w3schools.com/sql/sql_delete.asp) before INSERT
+
+- surround any table or field name with `backticks`, and string values with `single quotes`, example:
+
+``UPDATE `table_name` SET `field_I_want_to_change` = 'new string value' WHERE `entry` = 10 ;``
+
+## How to create an sql update file
+
+This kind of procedure is pretty simple and allow any kind of dev, but also testers, to avoid multiple import of the same queries.
+
+We can proceed by steps:
+
+1. Go into **data/sql/updates** and choose the **pending** folder corresponding to the database you apply your SQL to (pending_db_auth or pending_db_characters or pending_db_world).
+
+2. Run the create_sql.sh script with your bash console. On **Windows**: Use `git bash` (right click on the file). On **Unix/Linux/OSX**: run it from the terminal directly or with "bash create_sql.sh" or execute it with a double click.
+
+3. Now you'll have a file called **rev_[a_long_number].sql** , you can open it and add your queries into.
+
+4. Commit with Git and push to github. Follow our tutorial to create a Pull Request.
+
+
+--------
+This feature grants you ( dev / tester / user ) to:
+
+- create PR without going crazy with the alter table header, but avoiding multiple imports
+- avoid wrong order of updates
+- avoid data inconsistency if an sql generates an error \ No newline at end of file