Safe to update machine's environment from backend?

Hi, I just want to know whether it is safe to update the environments for target machines from backend?
Suppose my machine, Mac01 is in environment ENV01, but I want to change it to environment ENV02
So instead of changing from GUI, if i update it from backend with below SQL query:

update machine set EnvironmentIds = (select ‘|’ + Id + ‘|’ from DeploymentEnvironment where Name = ‘ENV02’)
where name = ‘Mac01’

Is it safe approach? Could it have adverse impact on the system? Please help

Hi Pratik,

Thanks for getting in touch! Direct changes to our database via SQL is both unsafe and will void your warranty.
If you want to script any changes you should use the API.

Warm Regards,

So does it void the warranty even if it happens for just one record in machine table?
I don’t see any problem with the functionality yet.
Also if i delete the environment from GUI, the record will get deleted from database.

Please let me know whether in such scenario, will we have to do the whole Octopus server set up process again?

Hi Pratik,

Deletions are never for just a single record. Via the UI and API any deletion will do a correct cascading deletion for all corresponding records and references.
Just deleting a machine means you can effectively break the entire UI because that machine might have been a scope to a variable or other such reference. This is why you should never touch data via the database. It cannot be supported when you do delete something in this manner, as we would then have to figure out why your UI is throwing errors or your API scripts are broken.

If you have already done this, and there are any issues, we can attempt to help to correct any effected data, but please do not do any more direct database changes.


Ok thanks Vanessa, that helps :slight_smile: