This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

TonUK
TonUK

Having a website in October built, using custom plugins and then you want to add more features etc. Using the builder plugin on the local machine or test server for adding database columns for example is fine.

But what is best practice for the production server? Is it acceptable to copy the steps within the builder plugin to get the database into a matching state, or is it more advisable to transfer the updates/migrations generated and use the October:down & October:up functions within a terminal?

This is assuming version control isn't an issue.

Thanks

Last updated

mjauvin
mjauvin

Yes, it's preferable to keep using the migration files.

TonUK
TonUK

Thanks mjauvin. Is there any actual difference in execution though? Builder method simply saves the migration and executes it. The terminal command just runs the migrations which were uploaded via ftp.

I only ask because I am currently making updates to a site that I have locally and on a staging site, and will eventually be done on the live site too. If things run and work okay locally and on the staging site then it will be fine to do on the live site.

It's pretty tedious having to FTP files (they're old school at my company) and run commands in the terminal. It'd actually be faster to just do things through the builder on the fly after doing it on the local and staging sites.

mjauvin
mjauvin

So your question is whether you should use the Builder on the live server to replicate the changes done on the test server or just upload the changed migration files from the test server to the live server and run the migrations manually?

If you're confident the changes done directly in builder will be identical, it's going to be equivalent, but there is more potential of errors when doing it this way...

JenniferLopez
JenniferLopez

TonUK said:

Is it acceptable to copy the steps within the builder plugin to get the database into a matching state, or is it more advisable to transfer the updates/migrations generated and use the October:down & October:up functions within a terminal?

It all depends on your deployment process. If they're old school, you could simply upload the plugin files and migrations via FTP and then use the "Plugins & Updates" section (or the Builder itself) to run the migrations.

The only potential issue with this process is that if your new plugin files introduce an incompatibility with the database (eg. a query using a column that does not exist unless the migrations are run), this might fail and cause you to get exceptions on your site before you get to either of the above screens. The october:up command runs as a privileged command which means it does not instantiate plugins, so this is much more safe.

I personally use automated systems like GitHub Actions for deployment, which runs the command line actions like october:up, I feel it's the cleanest way of deployment that I have total control, but everyone's mileage may vary ;)

Last updated

TonUK
TonUK

mjauvin said:

So your question is whether you should use the Builder on the live server to replicate the changes done on the test server or just upload the changed migration files from the test server to the live server and run the migrations manually?

If you're confident the changes done directly in builder will be identical, it's going to be equivalent, but there is more potential of errors when doing it this way...

Thanks to you both for the responses. The above is exactly correct. I have maybe added 2 columns to an existing database table for instance.

The stuff I am working on is all part of a new section to the live site which isn't connected to the existing site. So there is no danger and repercussions elsewhere from a user / front end perspective.

And yep I personally would prefer a much more efficient way of having GIT actions set up or something similar, but we are not really moving with the times in that aspect of things.

Thanks again.

1-6 of 6

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.