Talk in English - US at ZgPHP meetup #86 2018/10
View Slides: https://slides.com/mirosvrtan/using-migrations-and-fixtures-zgphp/
Short URL: https://joind.in/talk/9dc1d
(QR-Code (opens in new window))
Manually adding data to our development environment is tedious and boring, not being sure on what changes will be applied to production database after deployment can be dangerous. To battle this issues, developers decided to load gigabytes of production data on their machines or run queries manually before or after deployment.
In the world of crazy fast changes, working with more and more team mates and on more complex projects, automation and reliability are becoming a must have. Fixtures will give you opportunity to have small yet relevant data set so you don't have to import production data or enter testing data into the system your self, every time system changes. By using migrations we can easily transfer database changes amongst the team and get the confidence on the changes that will be applied to staging/production.
In my case, both concepts helped communicate changes better and allowed us to modify the system with more confidence and at a faster pace.
While some popular frameworks and ORM's don't ship with fixtures or migrations support by default, there are great extensions to provide this. I will showcase ones for Symfony and Doctrine but talk is more about their concepts and not the implementations.
Comments
Comments are closed.
Useful talk for those who aren't familiar with database migrations and fixtures. Inspired me to give a follow-up lightning talk.
Suggestions:
- Change the title to "Using database migrations and fixtures" to avoid confusion
- There is a slide with a yellow title on a white background - unreadable even from a first row (maybe it's just a bad projector, IDK)
- Show how doctrine can generate the diff SQL query in CLI by executing doctrine:schema:update --dump-sql
- Think about the case I mentioned about fixtures for CMS projects, listings, paginations, ... where it's useful to have more than a few manual entries
- TBH I'd rethink the unisex names comment. I don't think the diversity issue will be resolved by having 50:50 ratio between male/female names in fixtures, variables, or by using he/she in the specifications in a balanced ratio :)
4/5 only because I think it'll get better after a few iterations :)
Great talk, learned some new stuff, I really liked the "refresh-db" script, its so simple and powerful yet I rarely use something like that.
Aside from that, speaker seemed extremely prepared and experienced with the tooling, even in a few glitch situations with unexpected results, the flow was good and he was back on track in a few seconds. Also, IDE/code presentation style and speed was possibly one of the best I've seen.
I like how he explained the differences between popular frameworks around the subject of DB migrations and fixtures.
As something to change, I would suggest maybe show how a real environment looks like, and some real world cases that don't maybe go as planned.
I already know that but think that this is very useful. When you have a mic in your hands, please put it closer to the mouth :)
Really useful information (even though we use this almost every day).
I like the concept of constant fixture data (and reasons why not to use Faker for development fixtures).
4/5 just because the theme was a little rough, but it will be perfect within next few iterations. :)
Miro explained the concepts of migrations and data fixtures in the context of database schema, and showed by practical examples when and how to use them by utilizing Doctrine.
Despite few technical problems, everything went smooth, showing he invested a serious amount of time and effort to present everything as a coherent whole with a flow.
Miro has mastered his presentation skills, because I have seen him give numerous talks without worrying about the timer, and always wrapping things up on the minute.
This talk sparked quite a discussion with a fair amount of people having very similar questions, mostly about using Faker or similar libraries for generating dummy data.
IMO this is one of the things that could be included in the talk, explaining pros and cons of using such libraries and when.
There was a mention of dependent fixtures, in addition to ordered ones, but no examples were given. This too is something I think could be introduced and explained a bit better.
There were some issues with the mic and Miro could have held it closer to this mouth for a better sound.
It was a good talk with good examples. The way the Laravel does migrations seems a bit better to me in theory while in practise it might be different. Miro talked about "seeding" some minor data to the database and didn't mention how to approach the situation when you need a bit more data to simulate a real application -> such as generating a few thousands or more record in each of your tables and checking out how your app behaves then.
Good talk and interesting subject. Although most of us use migrations on a daily basis, I believe that there are a lot of people who do not use them and that this speech could be a good reference for them. It was also good to ask some questions and hear other experiences.