#Using an SQL File instead migration

20 messages · Page 1 of 1 (latest)

dim schooner
#

I have a legacy system that will upgrade to a new system and wants to use a SQL file in the database instead of using migrations.
I want to start simple, just using one column of user to the auth with breeze.
Anyone was any idea wow can I make this?

hollow river
#

Why? Migrations are like git for your database, it has many pros.

fading hazel
#

That's exactly what the schema:dump command does. You just have to put the sql file in database/schemas and name it the same way schema:dump does - then it will be imported at the beginning of the migrate process. Or you could create a migration that runs the import manually.

dim schooner
#

The project only uses one database and has a small development team that said them don't need table versioning. Just taking up time and maintenance when building the website for each column. 😕

hollow river
#

Even to small teams it has a benefit. If there's a new dev, or your PC crashes, how would you set up the project? Exporting a DB from production data? Sharing the files internally to create a DB?
Migrations really are a small investment that has long term benefits. Everyone uses their own local DB, you can quickly pull changes, you can swap systems etc. And as Mono mentioned, you can use a SQL export to start as a "base", from there start using migrations.

brisk surge
#

If you must have an sql file, keep it out of the Laravel project, and just share it with other ways

#

I have a 10+ year website that has a database that pre-exists Laravel. Keeping everything in migrations doesn't make sense for us

fallow verge
#

I don't quite understand the question. If you want to start with a users table only, you only need a users table migration.

thorn cove
#

Also triggered a little with 'migration for each column' sure, when you want to only add a column to an existing table and not lose the existing data then you'd make a migration but how often in reality does that happen...and even in development if you feel the need to add a column I suspect it's faster to make a migration and run it than go looking somewhere else.. also team can pull that change and migrate rather than each manually update their local environments.. only my 2c

dim schooner
#

The system is legacy and 11 years old, the Scrum Master pointed out that the migrations were affecting performance, page loading time and programmers' development time.

Honestly, I think migrations are great and I used them in my previous projects. I tried to justify the use with some of the comments available here. But I was unsuccessful.

I'm just a junior, so I don't have much voice or experience to try to argue with the team's decisions :(

dim schooner
dim schooner
thorn cove
#

You have a lot of different options here - but your scrum master is not correct - migrations have literally nothing todo with any page load..

dim schooner
#

huhcat Oh.

thorn cove
#

But yes as mentioned here you can use a db without using migrations - they're just there to make it easier.. but if team prefers to do it by hand then so be it 🙂

dim schooner
#

Yeah... So be it...
So... Does anyone know how to change the infraestructure of Laravel to just use one file?

#

Like... Wow I make model adjustments for it

cosmic ibex
dim schooner
#

I'll try, I'm really new to Laravel and working with legacy systems. So I basically just follow what they tell me... 😅

#

I just used Laravel to small personal project and rarely had to touch with the database