Documentation on adding default pages in a data migration
See original GitHub issueIt would be great if there was an example somewhere of creating pages via a data migration.
Here’s my attempt point97/marco-portal2/initial_data/migrations/0001_create_ocean_stories_container.py
It is deficient in that the URL doesn’t get set. As a workaround I set live = False
, so that the URL gets set on publish. There may be other data consistency issues which I haven’t bumped into yet.
Improvements to this approach?
Issue Analytics
- State:
- Created 9 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Data Migration - Default Rules - IFS Documentation
Rule ID Procedure Name Description
ADDOBJID MIGRATE% REPLICATION Create extra detail for OBJID
BUILDTRIGGERIF REPLICATION Build IF‑statement for updateable columns
CALLEXTPROC CREATE_OUTPUT_FILE Call external procedure after...
Read more >Performing the data migration - BMC Documentation
The first data migration moves all of the data that has been added or changed since you made the production backup. The second...
Read more >Data Migration Roadmap Guidance - Federal Student Aid
The following external documents provide either governance or guidance for this document. DOCUMENT ID. DOCUMENT TITLE. DOCUMENT. VERSION. Front ...
Read more >Migrate portal configuration - Power Apps | Microsoft Learn
We will soon migrate and merge the Power Apps portals documentation with Power Pages documentation. Portal development involves several ...
Read more >Data migration - Ibexa Developer Documentation
3.3, the ezmigrationbundle package has been removed to mitigate this issue. It is recommended that you use the default ibexa/migrations package to migrate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Idle thought - could we perhaps provide some helper functions for doing tree operations, that live outside of the Page class and are thus usable with the ‘barebones’ Page model that’s available inside migrations? Something like:
As far as I recall, most of the heavy lifting in django-treebeard happens outside the mixin in dedicated classes like AddChildOperation, so we could probably piggyback on those.
@kurtrwall For the reasons you have listed, we do not create pages in migrations. Instead we have management commands - one for creating the base site skeleton of required pages, and another that makes some random test pages. As they are management commands, they have full access to the proper models.
We try and keep the site skeleton management command idempotent with respect to existing data, so that running it multiple times as the project grows will have the same effect as running it on a new database. This does take extra work compared to migrations, and kind of duplicates the work of a migration, which is unfortunate.
I’ve not come up with a better solution. If anyone has a better idea, I would also love to hear it.