[GeoNode-users] Migration from 2.4

Olivier Dalang olivier.dalang at gmail.com
Wed Oct 17 18:34:29 PDT 2018


Hi !

I'm currently trying to migrate an old geonode install (2.4) to the current
version.
I managed to get the migrations to run after some tweaks (details below),
but the database is not consistent with the models.

Is this expected ? Or is there something wrong with the previous install ?
(it's old and I have no details about how it was installed). I searched a
bit about migrating old geonodes, but didn't find any details past
migrating with --fake-initial.

I can fix the schema with sqldiff (from django-extensions) but would like
to know if this is supposed to happen or not.

Thanks !!

Olivier



Here are the steps I did :

1) Run migrations with --fake-initial. This fails at :

Applying layers.0029_layer_service...
...
django.db.utils.ProgrammingError: column "service_id" of relation
"layers_layer" already exists

2) Manually fix this :
ALTER TABLE public.layers_layer DROP COLUMN service_id;

3) Run the migrations (they complete)

4) Check the consistency with python manage.py sqldiff -ae (from
django-extensions). There are inconsistencies, some of which will cause
problems (NOT NULL constraints, missing columns, etc.). Using this, I can
fix the schema (need to drop tables with no models).

BEGIN;
-- Model missing for table: account_accountdeletion
-- Model missing for table: account_account
-- Model missing for table: account_signupcoderesult
-- Model missing for table: account_signupcode
-- Model missing for table: celery_taskmeta
-- Model missing for table: celery_tasksetmeta
-- Model missing for table: djcelery_intervalschedule
-- Model missing for table: djcelery_crontabschedule
-- Model missing for table: djcelery_periodictasks
-- Model missing for table: djcelery_workerstate
-- Model missing for table: account_signupcodeextended
-- Model missing for table: djcelery_periodictask
-- Model missing for table: djcelery_taskstate
-- Application: actstream
-- Model: Follow
CREATE INDEX "actstream_follow_object_id"
ON "actstream_follow" ("object_id");
CREATE INDEX "actstream_follow_object_id_like"
ON "actstream_follow" ("object_id" varchar_pattern_ops);
CREATE INDEX "actstream_follow_started"
ON "actstream_follow" ("started");
-- Model: Action
CREATE INDEX "actstream_action_actor_object_id"
ON "actstream_action" ("actor_object_id");
CREATE INDEX "actstream_action_actor_object_id_like"
ON "actstream_action" ("actor_object_id" varchar_pattern_ops);
CREATE INDEX "actstream_action_verb"
ON "actstream_action" ("verb");
CREATE INDEX "actstream_action_verb_like"
ON "actstream_action" ("verb" varchar_pattern_ops);
CREATE INDEX "actstream_action_target_object_id"
ON "actstream_action" ("target_object_id");
CREATE INDEX "actstream_action_target_object_id_like"
ON "actstream_action" ("target_object_id" varchar_pattern_ops);
CREATE INDEX "actstream_action_action_object_object_id"
ON "actstream_action" ("action_object_object_id");
CREATE INDEX "actstream_action_action_object_object_id_like"
ON "actstream_action" ("action_object_object_id" varchar_pattern_ops);
CREATE INDEX "actstream_action_timestamp"
ON "actstream_action" ("timestamp");
CREATE INDEX "actstream_action_public"
ON "actstream_action" ("public");
ALTER TABLE "actstream_action"
ALTER "data" TYPE jsonb;
-- Application: tastypie
-- Model: ApiKey
ALTER TABLE "tastypie_apikey"
ALTER "key" TYPE varchar(128);
-- Application: base
-- Model: ContactRole
ALTER TABLE "base_contactrole"
ALTER COLUMN "resource_id" DROP NOT NULL;
-- Model: ResourceBase
ALTER TABLE "base_resourcebase"
DROP COLUMN "distribution_url";
ALTER TABLE "base_resourcebase"
DROP COLUMN "distribution_description";
-- Model: Link
ALTER TABLE "base_link"
ALTER COLUMN "resource_id" DROP NOT NULL;
-- Application: layers
-- Model: Layer
ALTER TABLE "layers_layer"
DROP COLUMN "distribution_description_en";
-- Application: maps
-- Model: Map
ALTER TABLE "maps_map"
DROP COLUMN "distribution_description_en";
-- Application: documents
-- Model: Document
ALTER TABLE "documents_document"
DROP COLUMN "distribution_description_en";
ALTER TABLE "documents_document"
ALTER "doc_file" TYPE varchar(255);
ALTER TABLE "documents_document"
ALTER "doc_url" TYPE varchar(255);
-- Application: people
-- Model: Profile
ALTER TABLE "people_profile"
ALTER "email" TYPE varchar(254);
ALTER TABLE "people_profile"
ALTER COLUMN "last_login" DROP NOT NULL;
-- Application: groups
-- Model: GroupProfile
ALTER TABLE "groups_groupprofile"
ALTER "email" TYPE varchar(254);
-- Application: upload
-- Model: Upload
ALTER TABLE "upload_upload"
ADD COLUMN "mosaic_time_value" varchar(128);
ALTER TABLE "upload_upload"
ADD COLUMN "mosaic_time_regex" varchar(128);
ALTER TABLE "upload_upload"
ADD COLUMN "mosaic_elev_regex" varchar(128);
ALTER TABLE "upload_upload"
ADD COLUMN "mosaic_elev_value" varchar(128);
COMMIT;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20181018/e836c8ca/attachment-0001.html>


More information about the geonode-users mailing list