<commit_before>To migrate data from previous version dump the data into the data folder
with the names mentioned below. Load the files in the following way:

1. Do this before installing the new version with >>> sh install_all.sh
2. python manage.py dumpdata dashboard --all --settings="geonition.***" > ../data/dashboard.json

STEP BY STEP:
1. git clone releases from github
2. sh install_all.sh --> installs django and everything
3. create a settings_<site>.py file for the site you are going to use
4. add to settings_<site>.py database, admins, debug, time_zone, language_code,
languages, MEDIA_ROOT, EMAIL_BACKEND and other email settings
5. copy gntimages (base images) to MEDIA_ROOT
6. set SPATIAL_REFERENCE_SYSTEM_ID to the right value (e.g. 3067)
7. Write a javascript file with your analytics script for the installation
8. set ANALYTICS_TEMPLATE to the template file where you have your analytics script
9. python manage.py syncdb --settings="geonition.settings_<site>"
10. python manage.py collectstatic --settings="geonition.settings_<site>"
11. python manage.py test --settings="geonition.settings_<site>" #should pass all the tests

Finnish the migration steps:
3. Drop the rows in dashboard_project tooltip*
4. Add a new row in dashboard_project called modify_date with default now() and NOT NULL
5. Remove the default now() option
6. run python manage.py data_migrate <absolute path to data dump folder> --settings="<settings for site>"

And now everything should be up and running.


Do not use migrate data but use these SQL commands to modify your database (data migrate is supposed to be updated and do just this instead):
/*
diff new.sql old.sql
<     "slug" varchar(200) NOT NULL UNIQUE,
<     "name" varchar(200) NOT NULL,
<     "name_fi" varchar(200),
<     "name_sv" varchar(200),
<     "page_type" varchar(5) NOT NULL
---
>     "slug" varchar(50) NOT NULL UNIQUE,
>     "name" varchar(50) NOT NULL,
>     "name_fi" varchar(50),
>     "name_sv" varchar(50),
>     "type" varchar(5) NOT NULL
32,35c32,35
<     "name" varchar(200) NOT NULL,
<     "name_fi" varchar(200),
<     "name_sv" varchar(200),
<     "slug" varchar(200) NOT NULL UNIQUE,
---
>     "name" varchar(100) NOT NULL,
>     "name_fi" varchar(100),
>     "name_sv" varchar(100),
>     "slug" varchar(100) NOT NULL UNIQUE,
*/

/* geoforms_questionnaire table */
ALTER TABLE geoforms_questionnaire ALTER slug TYPE varchar(200);
ALTER TABLE geoforms_questionnaire ALTER name TYPE varchar(200);
/* following lines depend on language settings */
ALTER TABLE geoforms_questionnaire ALTER name_fi TYPE varchar(200);
ALTER TABLE geoforms_questionnaire ALTER name_sv TYPE varchar(200);

/* geoforms_geoform table */
ALTER TABLE geoforms_geoform ALTER slug TYPE varchar(200);
ALTER TABLE geoforms_geoform ALTER name TYPE varchar(200);
ALTER TABLE geoforms_geoform RENAME type TO page_type;
/* following lines depend on language settings */
ALTER TABLE geoforms_geoform ALTER name_fi TYPE varchar(200);
ALTER TABLE geoforms_geoform ALTER name_sv TYPE varchar(200);
<commit_msg>installation instructions modified to handle view creation<commit_after>To migrate data from previous version dump the data into the data folder
with the names mentioned below. Load the files in the following way:

1. Do this before installing the new version with >>> sh install_all.sh
2. python manage.py dumpdata dashboard --all --settings="geonition.***" > ../data/dashboard.json

STEP BY STEP:
1. git clone releases from github
2. sh install_all.sh --> installs django and everything
3. create a settings_<site>.py file for the site you are going to use
4. add to settings_<site>.py database, admins, debug, time_zone, language_code,
languages, MEDIA_ROOT, EMAIL_BACKEND and other email settings
5. copy gntimages (base images) to MEDIA_ROOT
6. set SPATIAL_REFERENCE_SYSTEM_ID to the right value (e.g. 3067)
7. Write a javascript file with your analytics script for the installation
8. set ANALYTICS_TEMPLATE to the template file where you have your analytics script
9. python manage.py syncdb --settings="geonition.settings_<site>" (run this command twice, as the views of geodjango models cannot be created with custom sql,
in django version 1.5 the python manage.py syncdb --no-initial-data can be used for the first run)
10. python manage.py collectstatic --settings="geonition.settings_<site>"
11. python manage.py test --settings="geonition.settings_<site>" #should pass all the tests

Finnish the migration steps:
3. Drop the rows in dashboard_project tooltip*
4. Add a new row in dashboard_project called modify_date with default now() and NOT NULL
5. Remove the default now() option
6. run python manage.py data_migrate <absolute path to data dump folder> --settings="<settings for site>"

And now everything should be up and running.
{'fraction_non_alphanumeric': 0.08328128253175099, 'fraction_numerical': 0.02623360399750156, 'mean_word_length': 4.553757225433526, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 36, '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': '1256243', 'n_tokens_mistral': 1499, 'n_tokens_neox': 1387, 'n_words': 616}