mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
ffd866cedc
refs https://github.com/TryGhost/Team/issues/555 - Export files included a lot of data which was not used in the importer, for example: members, labels, migrations and many more. This lead to a lot of clutter in the import files and made it hard to reason about their purpose. - The main purpose of exports - is to export importable resources. These are posts, tags, and users. The rest of data like members or migrations either have their own importer (like CSV importer for members) or does not and should not have any ways to be imported. - These changes are in now way complete. It's a first step towards resource-based exports which could be properly versioned in the future on API level and not be a mirror of the DB structure. - This is sort of a breaking change. But we are doing it because: (1) its an internal API that should not be used by external clients, (2) there was no public contract to have this API stable at any point, (3) we really need to get back the control over export files structure and size - In case an external client was dependent on some structure of the exported json file they can still pass in ALL of previously exported data by passing table names in `include` query parameter. |
||
---|---|---|
.. | ||
body-generator.js | ||
broken.json | ||
README.md | ||
v2_export.json | ||
v3_export.json | ||
v4_export.json | ||
valid.json |
Steps to generate a new vX_export.json
file:
ghost install --version 3.0.0
- install a local version of Ghost using the X version- When prompted for blog details use following data for consistency:
- blog URL: accept default (http://localhost:2368)
- MySQL hostname: whatever is configured locally (localhost in my case)
- MySQL username: whatever user is configured locally
- MySQL password: whatever is configured locally for the user
- Ghost database name: accept default (fresh_3_0_prod as an example)
- "ghost" MySQL user: n (unless you need one for your local setup)
- set up Systemd: n (no reason to set this up locally)
- start Ghost: n (need to fix permissions first)
- run
sudo chown -R $USER:$USER content
(this is needed for local setup as the CLI creates content folder with ghost:ghost permissions) - start Ghost instance:
ghost start
- Register with test user account with following details:
Testing Export Fixtures
- Site titleFixture Ghosty
- Full name- {your_email}@ghost.org - Email address (I used naz@ghost.org as an example, this is to prevent spamming test@ghost.org)
- Password - generate one (for example use 1Password to autofill it)
- Go to Admin panels's labs page and download an export (
/settings/labs
page and "Export your content" section) - Format and rename exported data:
jq . testing-export-fixtures.ghost.2021-03-24-01-15-52.json > v3_export.json
(can usevX_export.json
where X is a Ghost version number) - Copy the file into
/utils/fixtures/export
project folder by running e.g.:cp ./v3_export.json ~/Ghost/test/fixtures/export/
- Replace email used during registration with a generic
test@ghost.org
can use following commandsed -i 's/naz@ghost.org/test@ghost.org/g' v3_export.json
(replace naz@ with an email you used and use appropriate json file name) - Check the tests and commit new/updated export file
Note, the export contains Ghost's default configuration with no customizations. In the future iteration it would be useful to add more custom data like users with different roles, multiple posts and pages with different sets of customizations like metadata, pictures and so on.