Problem/Motivation
The Umami Demo install profile uses bespoke code to create its content from a collection of CSV, HTML and image files. However, #2931739: Bring migrate_source_csv to core is targeted for inclusion in 8.6.x and it would be great to adopt migrate via the new CSV source plugin as soon as possible when that lands.
Proposed resolution
Replace the code in Drupal\demo_umami_content\InstallHelper methods with migrations, executed at install time.
Note this is speculative work at this time as #2931739: Bring migrate_source_csv to core is yet to land. Also when/if #2954378: Use Media images in Umami demo is complete, tweaks to the import process will be needed as we'll be migrating media items as well as images.
Remaining tasks
TBD
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#4 | 2983573-4.patch | 12.52 KB | mohit_aghera |
#3 | 2983573-3.patch | 991 bytes | martin_q |
Comments
Comment #2
Eli-TComment #3
martin_qTo simplify the migration work, I've created a separate users.csv file and a user import. In recipes.csv I replaced the user names with user IDs. Then in the recipes import I've got a migration lookup which finds out the uid in the imported site and uses that as the author for the recipe. I've modified the articles.csv file in the same way. @Mohit, you'd need to change the articles import in the same way to use the imported users.
Comment #4
mohit_aghera CreditAttribution: mohit_aghera as a volunteer and at Axelerant commentedImplementing initial patch for article migration implementation.
Updated following things:
- Added changes from #3 patch.
- Added migration for importing article content item
Right now i have commented actual function callback that imports content that imports content, i.e. below snippet in "demo_umami_content_install()" hook.
Instead of this, we are using article migration to import content.
To run and test on local: we need to apply patch from #2931739
Comment #7
DuaelFrFYI #2931739: Bring migrate_source_csv to core has been closed as "Won't fix" :/
Comment #8
Eli-TMoving to won't fix also due to the previous comment
Comment #9
martin_qWith all the attention OOTB gets these days, I have been feeling bad about not ever getting around to completing my work on this. I guess if it's no longer feasible then it's fortunate I didn't. I take it there isn't another flat file format for which migrate has a module in core already?
Comment #10
DuaelFr@martin_q You could find a workaround by using the
embedded_data
source and altering the migration at runtime to provide the data as an array.You could gather the data from a Json file and preprocess it with
\Drupal\Component\Serialization\Json::decode()
by yourself, or keep building the data array from a CSV file like you currently do.