Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Add option to install the API without having to install the database #294

Closed
rijkvanzanten opened this issue Aug 6, 2018 · 9 comments
Closed
Labels
enhancement New feature or request
Projects

Comments

@rijkvanzanten
Copy link
Member

When you already have a database, or you use an existing SQL copy, the post to /instances will fail. We should add a param that allows the user to create the config file without having to overwrite the DB

@rijkvanzanten rijkvanzanten added the enhancement New feature or request label Aug 6, 2018
@stale
Copy link

stale bot commented Dec 30, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 30, 2018
@benhaynes benhaynes added this to To do in v2.0.14 via automation Jan 1, 2019
@benhaynes
Copy link
Sponsor Member

This one seems pretty straightforward... any idea how complex this is @wellingguzman ?

@stale stale bot removed the stale label Jan 1, 2019
@wellingguzman wellingguzman moved this from To do to In progress in v2.0.14 Jan 4, 2019
@wellingguzman
Copy link
Contributor

The title and the description leads me to different thing. Do we want to create the database even when it doesn't exists, or install a new project even if that database is not empty, or both?

At the moment you can install a new project to a database that already exists, as long as there's not a single directus table. if you want to overwrite everything you set the force option to true.

Are we looking for creating the database when it doesn't exists? @benhaynes @rijkvanzanten

@rijkvanzanten rijkvanzanten changed the title Add option to install the API without a database Add option to install the API without having to install the database Jan 4, 2019
@rijkvanzanten
Copy link
Member Author

At the moment you can install a new project to a database that already exists, as long as there's not a single directus table.

This is what the issue is about. Installing a new project on a database that already has the directus_* tables.

@benhaynes
Copy link
Sponsor Member

Would we do a check to make sure the existing *_directus tables/field are correct? Would we run migrations to get things up-to-date?

@wellingguzman
Copy link
Contributor

This is what the issue is about. Installing a new project on a database that already has the directus_* tables.

Ah understood. What we are doing is creating the config files as you described above.

Some questions:

  • Do we want to just do it without an options? if force=false (default) and there's some table that starts with directus_, we avoid creating tables, and just create the config files.

  • Do we want to run the db upgrade automatically, or let the user do it separately, or add an option? I prefer add an option default to false.

Scenario:

  • If force=false and there's at least one of Directus table, only creates the config file.
  • If force=false and there's at not a single Directus table, creates config and tables.
  • If force=true and there's at least one of Directus table, remove all Directus collection, and install everything.

@rijkvanzanten
Copy link
Member Author

Maybe we should add another flag, like force, that will install it on top of an existing installation.

force=true should clear everything and install directus fresh
existing=true should install just the config files (and maybe run migrations)

By default, the API will return an error if the data already exists (that way the app can render a confirm modal)

Thoughts @wellingguzman?

@wellingguzman
Copy link
Contributor

You right, a new flag is better. The API already throws an error when there's already Directus Tables.

One more question, If existing=true, but there's not tables, should it install the tables. Basically what existing=true will means is do not warn me that the tables exists, just ignore it, and create the config only, correct?

@rijkvanzanten
Copy link
Member Author

will means is do not warn me that the tables exists, just ignore it, and create the config only, correct?

I think so, yeah!

v2.0.14 automation moved this from In progress to Done Jan 4, 2019
wellingguzman added a commit that referenced this issue Jan 4, 2019
samvasko pushed a commit to samvasko/api that referenced this issue Nov 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
No open projects
v2.0.14
  
Done
Development

No branches or pull requests

3 participants