<commit_before># Upgrade from Asqatasun v4.0.3 to v4.1.0

Here is all the information you need to upgrade your Asqatasun instance. All information is given to be done manually.
You may use the provided script to automate it.

## Scripted upgrade

TBD

## Steps

The following steps detail what has to be done.

## 1. Stop Tomcat

```
service tomcat7 stop
```

## 2. Change mysql-client parameters for utf8mb4

It is **important to change this first** and foremost, or the mysql-client could not be able to have a
correct communication with the storage engine.

In you `/etc/mysql/conf.d/asqatasun.cnf`, adjust the following values

```
[client]
default-character-set=utf8mb4

[mysql]
default-character-set=utf8mb4

[mysqld]
collation-server = utf8mb4_general_ci
init-connect='SET NAMES utf8mb4'
character-set-server = utf8mb4
```

## 3. Backup database

Yes do it, because you know you should :)

```shell
mysqldump -u asqatasun -p asqatasun >/tmp/BACKUP_asqatasun_$(date +%Y-%m-%d).sql
```

## 4. Apply new character set + collation + reduction of size on index columns

Apply to the `asqatasun` database the following two scripts:

TODO: backup database

```shell
/usr/bin/mysql -u asqatasun -p asqatasun < engine/asqatasun-resources/src/main/resources/sql-update/asqatasun-40-update-from-4.0.3-to-4.1.0.sql
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-update/tgol-40-update-from-4.0.3-to-4.1.0.sql
```

## 5. Adjust `asqatasun.conf`

## 6. Copy new WAR file<commit_msg>DOC: upgrade: procedures deletion + re-creation<commit_after># Upgrade from Asqatasun v4.0.3 to v4.1.0

Here is all the information you need to upgrade your Asqatasun instance. All information is given to be done manually.
You may use the provided script to automate it.

## Scripted upgrade

TBD

## Steps

The following steps detail what has to be done.

## 1. Stop Tomcat

```
service tomcat7 stop
```

## 2. Change mysql-client parameters for utf8mb4

It is **important to change this first** and foremost, or the mysql-client could not be able to have a
correct communication with the storage engine.

In you `/etc/mysql/conf.d/asqatasun.cnf`, adjust the following values

```
[client]
default-character-set=utf8mb4

[mysql]
default-character-set=utf8mb4

[mysqld]
collation-server = utf8mb4_general_ci
init-connect='SET NAMES utf8mb4'
character-set-server = utf8mb4
```

## 3. Backup database

Yes do it, because you know you should :)

```shell
mysqldump -u asqatasun -p asqatasun >/tmp/BACKUP_asqatasun_$(date +%Y-%m-%d).sql
```

## 4. Apply new character set + collation + reduction of size on index columns

Apply to the `asqatasun` database the following two scripts:

TODO: backup database

```shell
/usr/bin/mysql -u asqatasun -p asqatasun < engine/asqatasun-resources/src/main/resources/sql-update/asqatasun-40-update-from-4.0.3-to-4.1.0.sql
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-update/tgol-40-update-from-4.0.3-to-4.1.0.sql
```

## X. Delete + recreate SQL procedures

```shell
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-management/PROCEDURE_AUDIT_delete_from_user_email.sql
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-management/PROCEDURE_CONTRACT_delete_from_label.sql
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-management/PROCEDURE_CONTRACT_functionality_add_from_contract_label.sql
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-management/PROCEDURE_CONTRACT_functionality_add_from_user_email.sql
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-management/PROCEDURE_CONTRACT_functionality_remove_from_contract_label.sql
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-management/PROCEDURE_CONTRACT_functionality_remove_from_user_email.sql
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-management/PROCEDURE_CONTRACT_referential_add_from_contract_label.sql
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-management/PROCEDURE_CONTRACT_referential_add_from_user_email.sql
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-management/PROCEDURE_CONTRACT_referential_remove_from_contract_label.sql
/usr/bin/mysql -u asqatasun -p asqatasun < web-app/tgol-resources/src/main/resources/sql-management/PROCEDURE_CONTRACT_referential_remove_from_user_email.sql
```


## X. Adjust `asqatasun.conf`

## X. Copy new WAR file
{'fraction_non_alphanumeric': 0.11151463362529374, 'fraction_numerical': 0.017090365306558428, 'mean_word_length': 4.587112171837709, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 5, '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': '1796458', 'n_tokens_mistral': 1771, 'n_tokens_neox': 1669, 'n_words': 407}