[GeoNode-devel] Database Migration from 2.4 to 2.8 bug in 0029_layer_service.py

Toni Schönbuchner toni.schoenbuchner at csgis.de
Fri Aug 3 03:56:19 PDT 2018

Dear Devs,

I´d like to share some experiences migrating geonode database (not geonode_data!) 
from 2.4 to 2.8. This is what I did:

1) _	dumped geonode 2.4 database
	$ sudo -u postgres -i pg_dump -c -Fc geonode > /some_path/geonodedb.backup

2) _	installed fresh geonode 2.8 (Ubuntu with project)
3) _ 	created new DB imported old 2.4 dump
	$ sudo -u postgres createdb -O geonode geonode_new;
	$ sudo -u postgres -i pg_restore -Fc -d geonode_new /some_path/geonodedb.backup

4) _ 	run migrations
	$ python manage.py migrate --fake-initial --settings=my_geonode.local_settings

this ended in several problems like 
	people_timezone field was expected but did not exist. 
	layers_layer.service_id already existed.

After some rubber duck debugging it worked the moment I´ve deleted layers_layer.service_id
before migration:

	$ sudo -u postgres psql -d geonode_new -c 'ALTER TABLE "layers_layer" DROP COLUMN service_id‘
	$ python manage.py migrate --fake-initial --settings=my_geonode.local_settings

Good to know: 
It worked no matter if I´ve used a dump from 2.4 directly or by doing a intermediate migration by use
of geonode 2.6! In every case I´ve ended with 99 tables.

I´ve just tested with demo data installed by paver by now but suspect a bug with migration from
layers: 0029_layer_service.py. 

My vage ques is that layers_layer.service_id is created by a previous running migration from service app. 
The only workaround I´ve found so far is by backup and delete mentioned field (—fake brought new problems). 

I hope this helps others, if somebody has a better solution how to solve this issue I´m open year !



@Francesco: this time the moon was on my side ;D


Kolonnadenstraße 1
04109 Leipzig
Mobil	+49/ (0) 176 6680 3198
Tel 		+49/ (0) 341 24 04 738
Fax 		+49/ (0) 341 24 04 73
Web		http://csgis.de

Hinweis gemäß § 33 BDSG
Daten der Verfahrensbeteiligten werden gespeichert. Dieses Dokument ist ausschließlich für den 
Adressaten bestimmt. Der Inhalt der E-Mail ist vertraulich. Falls Sie diese E-Mail versehentlich 
erhalten haben, rufen Sie uns unter obiger Rufnummer umgehend an und löschen Sie diese Nachricht 
von Ihrem Computer. Jegliche Art von Reproduktionen, Verbreitung, Vervielfältigung, Veränderung, 
Verteilung und/oder Veröffentlichung dieser E-Mail ist verboten.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20180803/c50188cb/attachment.html>

More information about the geonode-devel mailing list