Coder Social home page Coder Social logo

ijsto / strapi-plugin-migrate Goto Github PK

View Code? Open in Web Editor NEW
76.0 4.0 7.0 289 KB

Strapi-Plugin-Migrate helps to migrate Strapi data from one environment of your app to another. For example development > staging

JavaScript 100.00%
strapi strapi-plugin strapi-cms strapijs

strapi-plugin-migrate's Introduction

Strapi plugin Migrate

About

Strapi Plugin Migrate let's you easily transfer user permissions, settings, and layouts between your Strapi instances.

More info

For an example, let's consider User Permissions - when you configure User Permissions for routes and roles in, for example, `development`, these settings are stored in your database and therefore are not transferred to your `production` environment.

Until now normally you would have to manually sync these checkboxes in your target environment. strapi-plugin-migrate enables you to simply export a file from your development environment (or any other) toΒ production (or any other).

Similarly - strapi-plugin-migrate enables the same for layout configuration and Strapi app Settings.


Quick start

1 - Install the plugin in your Strapi project

npm i strapi-plugin-migrate

or

yarn add strapi-plugin-migrate

2 - Rebuild your Strapi app and clean your cache

yarn build --clean && yarn develop

or

npm cache clean --force && npm run build && npm run develop

3 - Go to your Settings > Dashboard (in the new Migrate section)

4 - Export your data by downloading a JSON file or Copying the Text string

5 - Import your data in the target environment

Control access to the settings

By default, only admin panel users with Super Admin-role are able to access the settings of this plugin. Due to Strapi's restrictions you can't change this behavior if you are using the free Community Edition. When using Enterprise Edition you're able to adjust the settings for this plugin on the edit page of a role under Settings > Administration Panel > Roles > Select a role > Settings tab > Migrate. More information can be found here.

Updating to new version

When updating to a new version, you will need to rebuild your Strapi admin UI for the changes to take effect.

This is how we would update to the latest version:

from your Strapi project root folder:

yarn add strapi-plugin-migrate@latest && yarn build --clean

Contributing to/Developing this plugin

Thank you for considering to contribute! To find out please read the CONTRIBUTING.md.

Please make sure you read the contirbuting guide before making a PR.

Credits

Parts of the initial concept for a module in users permissions file JSON export was inspired by @Alan2207

strapi-plugin-migrate's People

Contributors

pr0gr8mm3r avatar sandeep1995 avatar scottagirs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

strapi-plugin-migrate's Issues

Detail Form & New Collection Item Form fail

Describe the bug
After uploading the permissions file, Strapi fails to load the detail form and the new collection item form. The error shows

Something went wrong.
Details
Cannot read properties of undefined (reading 'code')
TypeError: Cannot read properties of undefined (reading 'code')
    at h (https://ticda-api-dev.herokuapp.com/admin/main.6971d80e.chunk.js:1:9101115)
    at Ka (https://ticda-api-dev.herokuapp.com/admin/main.6971d80e.chunk.js:1:4271509)
    at gl (https://ticda-api-dev.herokuapp.com/admin/main.6971d80e.chunk.js:1:4317915)
    at cs (https://ticda-api-dev.herokuapp.com/admin/main.6971d80e.chunk.js:1:4310448)
    at ls (https://ticda-api-dev.herokuapp.com/admin/main.6971d80e.chunk.js:1:4310373)
    at Xl (https://ticda-api-dev.herokuapp.com/admin/main.6971d80e.chunk.js:1:4307382)
    at https://ticda-api-dev.herokuapp.com/admin/main.6971d80e.chunk.js:1:4258767
    at t.unstable_runWithPriority (https://ticda-api-dev.herokuapp.com/admin/main.6971d80e.chunk.js:1:4334347)
    at Vo (https://ticda-api-dev.herokuapp.com/admin/main.6971d80e.chunk.js:1:4258476)
    at Yo (https://ticda-api-dev.herokuapp.com/admin/main.6971d80e.chunk.js:1:4258712)

To Reproduce
Steps to reproduce the behavior:

  1. Export User Permissions with a public role that only has access to find operations from localhost running environment.
  2. Import User Permissions in a separate environment (e.g. Heroku).
  3. Open Collection table (any) that already had items in it.
  4. Open any item in the table.

Expected behavior
Application opens detail form and saves/works as usual.

Screenshots

Screen Shot 2022-03-05 at 23 19 47

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • Version: 98

Additional context

  • It also fails to load the "Add item" form on tables that did not contain any other items, meaning on empty tables.
  • Local environment uses develop command, while Heroku uses a production configuration.

Content Migration via file exports/imports

This problem is being actively updated and worked on.
| If you feel like you would be able to figure out a solution to the issue described below, please consider creating a pull request.

The problem/Objective

Ability to export Collection and Single Types along with the corresponding relations to one another.

If you have any thoughts or any details/suggestions you would like to this description, please leave a comment below. πŸ™πŸΌ

[Discussion] Text (SQL) exports/imports for Settings & Layouts

We currently support migrating Settings and Layouts for Strapi apps via a JSON file.

Unlike Roles and Permissions, where we also support SQL exports in form of text.

Please share your thoughts on which approach you prefer and if you'd like to see Text migrations supported for other types as well.

Cheerzz fellaszz

Exporting Collection/Single Types

This problem is being actively updated and worked on.
| If you feel like you would be able to figure out a solution to the issue described below, please consider creating a pull request.

The problem/Objective

Ability to export Collection and Single Types along with the corresponding relations to one another.

If you have any thoughts or any details/suggestions you would like to this description, please leave a comment below. πŸ™πŸΌ

Hook up missing translations/refactor hardcoded

The problem
Many instances of descriptions, titles and labels are currently hard-coded.

They should be moved to admin/src/translations/en.json

in folder: components/UserPermissions

  • components/UserPermissions/index.js
  • components/UserPermissions/BackUpExporter.js
  • components/UserPermissions/ExportPermissions.js
  • components/UserPermissions/ExportPermissionsText.js
  • components/UserPermissions/ImportPermissions.js

[List] Add missing MVP features

We need to add tests that will check that the IDs in target environment match the ones being imported.

Please feel free to add edges cases which you think should be covered with tests.

  • automatically sync roles
  • option to export a file

Error in README npm install instructions.

The readme instructions for installing the plugin with npm are missing the "npm run build" instruction. The admin UI is not being rebuilt, hence the plugin is not appearing in the admin panel.

It could be:
npm cache clean --force && npm run build && npm run develop
instead of
npm cache clean --force && npm run develop

Improve or create new logo

Anyone who has ideas and something to put into a creative outburst, please feel free to propose improvements to the logo

Silent failures in certain edge cases.

Describe the bug
Currently, when there are missing collection types, roles or other inconsistencies between environments, the import will fail on the server, but not on the client resulting in silent failure.

To fix, we need to throw an error in such cases. This should be a fairly simple fix, if anyone is interested in chipping in - a PR is most welcome πŸ™ŒπŸΌ

Text (SQL query) Exports for more databases

Problem.
Currently, text exports are only supported for Postgres databases.

Objective
Add support for the below database types:

  • MySQL
  • SQLite
  • MongoDB

PR Requests are most welcome

404 Not found when importing User-Permissions

PRELUDE

This issue is a point of reference for those who run into 404 error when importing user permissions.

Describe the bug
Currently, if we successfully export permissions and then try to import to the destination environment, the plugin may fail importing and throw 404 Not Found.

This most likely is caused because the Collection Types of your destination environment is not synced between the environments.

To fix you should ensure that you have pushed the latest changes to your Strapi instance to your destination environment and that you have restarted the process, for example, if you are using PM2, then you should run pm2 restart YOUR_INSTANCE_ID

PRs to ensure that the destination contains all the collection types are most welcome!

Add sort by to current roles

It would be easier to orient and change the role IDs if the order in which they are returned would persist. Additionally custom sorting could be beneficial.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.