mirino77's avatar

Tips for Production/Development local project.

Hi!

I have a tiny project I'm making on my own to learn. It's a tiny Order of Service's CRUD (those papers you give your clients when you make then an invoice when you sell them a service, detailing what was done and how much is owed, we call them that here in Brazil).

My question is: Is there an easy, Laravel-way of separating my production/development projects so that I can use it in it's current state, but can still develop it and, if necessary, run future migrate:fresh commands without losing the actual data I'm placing in?

I've thought of a few ways, but they seem "hacky and over-engineered" for me: 1: Import a package that allows me to export my production database to an xls file for backup, then import it back when necessary. 2: Read the name of the current database, and if it's Production, place a big red warning in home saying "Careful what you do, this is Production".

I'm thinking that maybe git can also help me with this? I've had some experience setting it up and using it, but I don't know if git can automatically update the production folder when I update development, without breaking anything...

Thanks in advance!

0 likes
4 replies
jlrdw's avatar
jlrdw
Best Answer
Level 75
  • Always backup before any migration
  • Have development setup same as Production
  • Git would probably the way to go
  • Consider Laravel Forge.
  • Consider host like digital ocean, they have excellent how to guides.
  • Consider viewing the Github series on Laracasts.
2 likes
martinbean's avatar

run future migrate:fresh commands without losing the actual data I'm placing in?

@mirino77 No, because that’s literally what migrate:fresh does: it trashes your database and then migrations. From fresh.

Read the name of the current database, and if it's Production, place a big red warning in home saying "Careful what you do, this is Production".

Laravel already does this if you try and run any migration commands in a production environment.

1 like
mirino77's avatar

Got some great tips from you guys. Thanks again!!

jlrdw's avatar

Just to note, when I said have production and development the same I meant folder structure, it makes it easier.

Before going to production read the laravel documentation chapter on deployment.

The very best of luck with your project.

Please or to participate in this conversation.