Patience and the right tools II – ways to handle 
content model changes

Patience and the right tools II – ways to handle 
content model changes

22725c2d3eb331146549bf0d5d3c050c?s=128

stefan judis

June 28, 2018
Tweet

Transcript

  1. 2.

    Stefan Judis Frontend Developer, Occasional Teacher, Meetup Organizer ❤ Open

    Source, Performance and Accessibility ❤ @stefanjudis
  2. 8.

    MIGRATION CLI CONTENT TYPE OPERATIONS Create a content type 01

    02 03 04 05 Delete a content type Edit a content type Create/edit/delete fields Change a field ID
  3. 9.

    Transform an entry in place 01 02 Derive an entry

    from another MIGRATION CLI CONTENT TRANSFORMATIONS
  4. 10.

    MIGRATION CLI ADVANTAGES Repeatable 01 02 03 04 Can be

    kept in VC Includes sanity checks Perfect for CI
  5. 11.
  6. 15.
  7. 18.

    cdn.contentful.com/spaces/{space_id}/environments/{environment_id}/entries const contentful = require('contentful'); const client = contentful.createClient({ space:

    '<space_id>', environment: '<environment_id>', accessToken: '<content_delivery_api_key>' }); client.getEntries();
  8. 19.

    COPIED Content types Entries Assets Locales UI-extensions Saved views SHARED

    Users & space memberships Roles & permissions API keys Web hooks
  9. 23.
  10. 30.
  11. 32.

    0_0_8.js module.exports = function runMigration(migration) { const post = migration.editContentType("post");

    post .createField("rating") .name("Rating") .type("Number") .required(false); return; };
  12. 33.

    - run: name: Preparing environment for testing command: | .

    venv/bin/activate python scripts/migration_prep.py "CI_$CIRCLE_BRANCH" scripts/migrate.js $SPACE_ID "CI_$CIRCLE_BRANCH" $MANAGEMENT_API_KEY
  13. 34.

    - run: name: Preparing environment for testing command: | .

    venv/bin/activate python scripts/migration_prep.py "CI_$CIRCLE_BRANCH" scripts/migrate.js $SPACE_ID "CI_$CIRCLE_BRANCH" $MANAGEMENT_API_KEY client = contentful_management.Client(MANGEMENT_API_KEY) environment = client.environments(SPACE_ID).create(TESTING_ENV, {"name": TESTING_ENV})
  14. 35.

    - run: name: Preparing environment for testing command: | .

    venv/bin/activate python scripts/migration_prep.py "CI_$CIRCLE_BRANCH" scripts/migrate.js $SPACE_ID "CI_$CIRCLE_BRANCH" $MANAGEMENT_API_KEY const {default: runMigration} = require('contentful-migration/built/bin/cli'); await runMigration({ /* ... */ }); client = contentful_management.Client(MANGEMENT_API_KEY) environment = client.environments(SPACE_ID).create(TESTING_ENV, {"name": TESTING_ENV})
  15. 37.