Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add import/export endpoints #2927

Closed
rijkvanzanten opened this issue Sep 18, 2020 · 13 comments · Fixed by #5660
Closed

Add import/export endpoints #2927

rijkvanzanten opened this issue Sep 18, 2020 · 13 comments · Fixed by #5660
Assignees
Labels
Milestone

Comments

@rijkvanzanten
Copy link
Member

The export endpoint allows you to export the output of multiple endpoints at the same time. This effectively allows you to export schema and data of the installation. Subsequently, the import endpoint should be able to intake this data and process it through the regular services, as if they were separate requests.

This allows you to move schema and/or data from/to different Directus installation, like staging to production

@rijkvanzanten rijkvanzanten self-assigned this Sep 18, 2020
@rijkvanzanten rijkvanzanten changed the title Add dedicated import/export endpoints Add import/export endpoints Sep 18, 2020
@prasadbandur
Copy link

Dear Directus maintenance team, as mentioned here directus/v8-archive#31 (comment) , and I/we too are looking out for any such feature if directus can provide to migrate the schema from one environment to stage/PROD etc. Let us/me know once you release this feature.

@rijkvanzanten
Copy link
Member Author

@prasadbandur Keep an eye on this issue 🙂 Once it's closed, it's merged into main and you can expect it in the first upcoming release 👍

@rijkvanzanten rijkvanzanten transferred this issue from another repository Nov 19, 2020
@aiomaster
Copy link

It would be really nice if the schema export would be in a good format for version control systems like git.
I think of usecases where you want to track your schema and develop it in different branches.
It would be really cool to be able to merge them and setup a directus out of the result.

I don't know if it is in scope, but it would be really cool to be able to kind of "migrate" an existing schema to a newer one. Or is it somehow already possible?

@rijkvanzanten rijkvanzanten added this to the v9.0.0 milestone Feb 10, 2021
@rijkvanzanten
Copy link
Member Author

See #4248 (reply in thread)

@zanami
Copy link

zanami commented Mar 26, 2021

@aiomaster I miss this feature very much. Some plain JSON/JS code to control both schema and presentation within admin UI would be really nice.

Strapi has it (a bit complicated, but flexible, I guess) — you can design your collections in UI and then tweak/change/reuse it.
It's very opinionated so does not play well with custom/existing databases, though.

Keystone, Payload - these are simply 'code/config first', so no 'model builder' available, just an example what the exported configs could look like. In Payload config files control both collections/fields (collection tables in Directus) and their behaviour: permissions, appearance in admin UI etc. (i.e. corresponding records in directus_* tables), .

The only 'source of truth' in Directus is the database. You can't easily track changes, find and resolve inconsistencies, test, share or reuse parts of its' schema etc.

Some kind of solution to this would be really useful even for an "App dashboard for managing SQL database content", and Directus is already much more than that.

@rijkvanzanten Please clarify it's out of scope. I found this comment from 2018. Anything new since then?

@rijkvanzanten
Copy link
Member Author

@zanami Nope, not out of scope at all. As a matter of fact, it's very likely that #3891 will land in the future as an alternative way of managing schema 🙂

As for that comment you linked, that's exactly what this issue is tracking, so that will be implemented soon

@adrchen
Copy link

adrchen commented Apr 16, 2021

Currently the only way of inputting information is by using the UI? At the moment I cannot "import", say, a XLS file into the database so the information gets loaded into the respective Collection?

@rijkvanzanten
Copy link
Member Author

@adrchen Hard no! You can insert it directly into the database, and it'll show up and work with Directus as expected 👍🏻

@benhaynes
Copy link
Member

Also, you can use the API (or SDK)... which is not UI, and we're actively working on the /import endpoint.

@adrchen
Copy link

adrchen commented Apr 16, 2021

Thanks for the reply, @rijkvanzanten & @benhaynes .

Could something like this work (I'll also try from my side)?

Also, any chance this is on Directus roadmap? Being able to import information into Collections done directly thru the UI.

@rijkvanzanten
Copy link
Member Author

rijkvanzanten commented Apr 16, 2021

Could something like this work (I'll also try from my side)?

This exactly should work just fine 🙂 I personally use TablePlus to modify my databases, but DBeaver is a perfectly fine tool too 👍🏻

Also, any chance this is on Directus roadmap? Being able to import information into Collections done directly thru the UI.

Yes absolutely. We already have the functionality to export to a file, adding a way to "mass import" from those files it the next iteration on that 👍🏻

As a matter of fact, it's such an important feature to us that it's one on the list of required things before we want to release 9.0.0

@mvarendorff
Copy link

Quick question: Is it really just possible to straightup dump the database and reimport it (as SQL dump for example) or is there additional data Directus stores on the collections like sorting keys, etc? Thanks for this amazing project, it's hard (not to say impossible) to find anything comparably clean yet extensible!

@benhaynes
Copy link
Member

@geisterfurz007 Thank you! Yes, a database dump has everything you need (except your asset files).

@rijkvanzanten rijkvanzanten modified the milestones: v9.0.0, v9.0.0-rc.65 May 17, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants