Duration 37:08
16+
Play
Video

RailsConf 2019 - Reset Yourself Free (The Joy of Destroying your DB Daily) by Chris Waters

Chris Waters
CTO at Staylists and Inn Style
  • Video
  • Table of contents
  • Video
RailsConf 2019
May 1, 2019, Minneapolis, USA
RailsConf 2019
Request Q&A
Video
RailsConf 2019 - Reset Yourself Free (The Joy of Destroying your DB Daily) by Chris Waters
Available
In cart
Free
Free
Free
Free
Free
Free
Free
Free
Add to favorites
592
I like 0
I dislike 0
Available
In cart
Free
Free
Free
Free
Free
Free
Free
Free
  • Description
  • Transcript
  • Discussion

About speaker

Chris Waters
CTO at Staylists and Inn Style

Platform Architect, OO Devotee, Rubyist, Rails Engineer and Writer. I have fifteen years’ experience sitting with creative and technical teams that build and market web-based products. Live in Suffolk with my wife, two daughters, stupid cat, and an envious Springsteen record collection.

View the profile

About the talk

RailsConf 2019 - Reset Yourself Free (The Joy of Destroying your DB Daily) by Chris Waters


When was the last time you ran rake db:reset locally?

My guess is not recently. Nor do you think of doing it frequently. And I want to persuade you that deleting your precious local environment this way is a Very Good Thing Indeed.

Because, friends, db:reset will not only delete your database, but it will seed it too.

And by spending quality time with your seeds file, I believe you’ll make your entire development team more productive.

You’ll give your project the opportunity to grow its own shared development environment – a beautiful, idealistic place where all devs can talk through the same problem in the same context.

Ready to reset with me?

Share

Thank you very much for coming. Before we stop I guess food is closer. This is my first day was cold. So if I do come up to looking pretty excited, that's because I am on Monday from London and Weinheimer Friday, and it's just been a tremendous privilege to be here to meet some people that you know, I've looked at from afar looked at that code. Maybe follow you guys on Twitter. And yeah, it's it's been a real thrill. So thank you for coming but more importantly. Thank you if you bother to stay. Just just as a side the

if you've never done a talk before can I recommend that you apply to do this next year? Because the whole process is being I'm using the word process of America so long to process the whole process just so easy. I would really recommend you to it. It was just as it's just been really relaxed. Like there's no kind of like crazy stuff about San Jose slides 3 years in advance when it's just been like to come and talk to is Alison really really friendly. So if you've never done it before, I just recommend

that everybody's been super love like I'm Chris. So Christmas song on pretty much all of the things that you can sign up for him cuz this name is Waze available because it's likely ways we can talk about that later if you'd like to but that's not the thing that I want to focus on the UK I'm sickly a lovely little County from Suffolk if you don't know where is Suffolk is a map for you coming up today. We we we we do like the farming in Suffolk. We might have some really good beer atmosphere and

we're pretty good at tourism as well. If you don't let me describe it. So this is a map of the UK and this is my son is now if you don't know what kind of looks like there's a kind of Handy things. It looks like a witch riding a pig right? So you can decide what are the pig do you think Suffolk actually is in this respect? However, the good news is there's like a pig skull on. It looks like a nice right? This is Southfield and Suffolk. These things are called Beach huts and if you throw brexit was a terrible idea, then you should see how much people will pay for one of

these things that used to say staggering amount of money is very pretty very beautiful. So we go quite a few hotels and campsites and b&bs and cutlasses and Consultants website and we said that it must be something out there. And it's good stylist online booking for hotels and b&bs that kind of thing as well. That's what we do. It's oval on Rails. So I guess it tomorrow. We have about 300 models. We thought about 40,000 commits to the code base overtime and 72

country fuse now. I don't know whether you think 72 sounds like a lot. I think Google is that a full-time employed for a long time? Which kind of makes me the CTO which is going cool, but I've been down here for a long time with contractures. I'm sorry. I don't feel like you may have seen some of this stuff like that the kind of always has and stuff. And we've always worked with these consultants. And so we have kind of rotation months developing song. So

maybe six weeks so we kind of constantly doing rotations new people. So they could oversee tackle some of the what we need to do. They can tackle some of those tickets about rotations is that when people leave when they get time to rotate it out for checks, they say nice things and one of the nice things they say Chris is Oracle. I said maybe I am. This is inevitable happens. So we have this idea of a stylist and a stylus is effective it collection hotels or B&B do campsites whatever collection of properties that you can book set one up which means to cut

some stuff up which means they need to set Hotel new develop economos to slap Cole on like Mariah Carey have to do it, but I do really want to And we go through. the developer having this useless local environment into something worse, which is a precious local environment and we end up with a situation where we'll most these people is local environment is is like production like they like sometimes I'm not really the Oracle and I'm not really the the linchpin in the business to go

and I like knowing things. I liked people depending on me, but I actually when people depend on you an awful lot you realize that you've got this wrong. I made a grave mistake in kind of not doing spreading that knowledge earlier. And so You know, that's a problem. I need to solve it and I guess the people of had but One X in life and business before and I read a little bit interested in other things other than just programming a kind of thing come from a programming background is a

product side. I'm so I kind of look to other people and one of the people that gave me an awful lot of inspiration is this guy? Hands up if anybody recognizes that night. Okay, cool, so what was a grocery store on is Ali If I found out after I'd actually written this tool from sand pool in, Minnesota. Ingles grocery store item about hundred years ago He observe something quite interesting and his grocery store and that was the people on people as much as they could

carry. and if I was Walter Auto probably works on wisdom and caring some bits But what did he came up with something entirely different? Which is one of these? He invented the paperback. It was invented here in Minnesota. If you know that and this pretty much overnight change the course of what was grocery shopping ever since. The lovely thing what was solution is the is incredibly lightweight and repeatable. And the interesting thing here is that there was something exactly the same for real is which so my problem.

Which is this? It's cool bright tv reset. And that's why this that's really what is talk is about it's about right they be reset. You came to a talk about rape tv reset with a little of wonderful stuff that's going on. So apologies, but let me try and convince you that that was a good idea to local environment set up iPad to just open up my run this. Okay, cool. So I'm going to just wait to you that you shouldn't want to do that. This is the thing that you should want to do and I'll tell you why okay, but fussy this just kind of

Explorer few things what happens when I run rake tv reset OK Surya T-Rex tv reset actually does a couple of things firstly it drops the TV. I know it runs DB Style. Okay, so it's just an alias for those two things together. And this is what does it? Lowest seed the database and the seed is the thing that I want to focus on cuz that's the interesting stuff. That's the thing that can really kind of reduce the dependency on you. If you on the one knows how old these objects interact with each other. Okay. So what happens when I run

rate the ABCs? So let's stop. Okay, so there's none more chill? codes database tasks runs load seat so far so good. So we kind of dive into a database tasks we can see that this load seed. I guess it kind of like delegates not explicitly using delegate but it does delegate to this seed loader. Okay, that's cool. What's he supposed to say, Florida? So have a look at actually what the save load it does. The sigmoid is actually the rails application. Okay, cool. Great.

That makes no sense. I'm so there for the rose application to sing. This actually loading is an engine. I'm in royalties, which school is low seat. And as you can see, it finds the DB seeds falling it but loves it. So it's just loading a ruby file. That's what Rick tv reset. Does. It loads the seeds off to doing the drill thing and then loading the schemer. Actually the seeding is just loading the ABCs. Everybody got a DV seeds file. Who is Norco TV seeds in their bios application? Okay, Ryan. Hands up who believes you need Stevie seeds

to be able to see the database by tasty Tunes. But creating seeds then so right now we know that it's just a ruby fall. We can just grab some seats, right? That's cool we have to do is just use active then we can we can create stuff. I personally like creating stuff with a bang cuz I want this to fail loudly of a very loudly because I wanted to create these eras instafollow. What's perhaps the fuse kind of tricks that you might not know creates can take an array. They can take an array of hashes

so you can create more points for the book anybody. Night in spectacles you can see if you don't want to think of names for 50 people. You can use some Wii U speaker. But uf's Streisand. I just thought maybe you could do stuff like this so you can just say why are you okay? Maybe I need to create 50 people and you can use fake or not cuz you more interesting day of the problems and stuff like that. You know, you want to come and see things for real noise

using the same name as long as names might cause some kind of you bugs and stuff. So it's quite interesting to do that. Fake is great. It's got like ridiculous amount of Spike day of the you can get so you can kind of take some of that stuff few of my favorites and we use this to keep count of optional extra. So if you're kind of staying at a hotel and you can see if you can get some kind of meat and hub and spy Spy. My favorite one is come out of his bad and basil interested one is Maybe

I like it was just this is just a certain amount enjoying that. Okay, so Receding immortalists right? I mean we can kind of create some active record stuff, but we going to 300 more so that's going to be a really big seeds Farm. So we kind of want to split them up when we can we can do that in Theses by just maybe so that's cool you do that. We choose not to do that. We choose to extract those seeds into a plus. So he's a way that you could do exactly the same thing and then you would load those seeds or you would load this file. Sorry.

this one unlock code in this So you would you even just like this in your save file? He's quite cool trick is the you can then rate run race tv reset and then do seed fall equals like pies if you just wanted to run pies and then you can use that kind of environment variable to kind of over right stuff. That's quite a trick that we was out. If Jason didn't you just want to see one particular file of so you can group your seeds as well. Let's find interesting trick to do which we've done. Okay, so the bonus round him. Which

is a the interesting bit is okay. Can you actually run break dbc's without a dbc's phone and you can do this how you do it when we were talking about loading the seeds that. It defers to the rails application, but you can see that it's kind of like woah. That's the kind of YFZ loader is Neil which kind of suggest the Cielo de can open them. And obviously you can then cool loads eaten something. So interesting thing here, is that the database? We can change all color instead of cooling a seed by language is a Alba tree we can change it to load seat. And then what will happen

to you is the in that module in that database tasks module. What we can do is we can actually set the seed. So we can now say that the seed loader is actually all c-dac Los Nopales a new instance of that to it. And then when you run right DB see you the right tv reset what it would do is it we use. Claus? I'm not mean so you can actually then delete uc's phone if you so wish. I'm so you need to include this application. Who is the what is the date for us? When we added to see the claws was it gives us an instant local environment?

No longer. Do I have to do the slap coups? No longer. Am I wasting time explaining the same thing over and over again? No longer. Do I have to help people through those struggles which ultimately parts of it where you need work to be done and what I was doing so I was just doing with that difficult because I didn't want to have to explain to people why we need to sell one of these one of these and if you sell one of them and they interact like this, then you kind of got no problem. That's the problem. We need

to solve. But I didn't want to spend an hour trying to set up the environment in order to then get them to do the work on the robber just done the work myself, which meant that I was thinking too much but I was burning out a little bit walking every night. So the joy of it is it gives you an instant local environment. Will the thing what it does is it gives you a consistent locally Farm? So when you working with all the developers, or see if we work with the guys Poland been so so remote a few

days a week and give me to remind developers. It's very very easy to to kind of communicate the same things right? If you go here if you use this particular Hotel, I'm so you know about four different hotels through this seating in this hotel, maybe unaccept kind of single gas and it's and it uses Like length-of-stay rules in this is a cottage and this is a hotel and it kind of does this kind of things we can now kind of frame problems all in the same kind of consistent language, you can have some fun naming things, you

know, and what it does is it just gives everybody a language to communicate about the local environment. I hotel and B hotel and a room and everything cost of 1 lb and it's just like so we don't have that problem anymore. The other thing is that we have a resilient local environment because I can literally recess just worry about it. I don't worry about going off and doing crazy things ways with Daya roll trying to run things in the fear that I'm going to do is just break my local environment and then we have to do the

slap called again added real kind of resilience into the process of building locally. And actually creates a prosperous local environment as well because once people realize that they can just reset they they get the joy of doing that and I understand why what happens when people build new sings or they solve new problems. They end up eating the seeds fall on the greatest thing is that now people kind of put things into the sea fall and we have more seeds and move contacts in the world of these things are available to everybody instantly just by running reset. So you end

up with something where you at your building together building these local environments together as well. You know when you create a new model it's now The wonderful thing about this is that it's dead right in front of his we get to use it for free. It's not I'm not advocating like over writing active recodo letting you know, I'm no Advocate. It's just it was blinding me. I must give him the credit for it. It was old bangs idea. I don't have a bit embarrassed that we didn't have one before we didn't have a really good seats are full because it's just created so so much speed

pretty much of which is why I went to call for proposals, but now it's like I want to talk about this. Little thing that you could do a cool show me some people on lunch about this is that everybody's got a rubbish staging environment like that like this like one account is so badly usable and stuff like that. I know is that you can, it's okay. I want to reset on production avoid that is why she can improve the communication on these kind of boring to go on about it is so important because all of a sudden you can talk to the QA and

you're talking about the same thing the same hotel in the same contacts and they don't have him to go to can I have a cold so I can set up the thing that you kind of money to fix on production effects on your local environment. Any other tests, we still need to Cuba and then so on and so forth. So it does all those things when you do all this stuff what I want, I think you'll find is that you will you will reset yourself free. I'm a little bit early, but that's it. Thank you very much.

Does anybody have any questions question? I'm so the question is when you have external data sources, you mentioned stripe. Yeah. Yeah. I'm like, how do you how do you say you'd like? Maybe one of our hotel connected to? I haven't got really clever answer for this but we use stripe hotels. We used to stripe connect platform. So I'll hotel has been kind of sign up for the red stripe accounts will see the business go through that. So what we did this we set up a just a completely separate dummy stripe account. And what we did is we connected to it

through the application and you cannot get the like account token in the Striped United the secret key in the public hanging not like those kind of things. We took those into the Safe Auto. I'm so those things are like a right pain in the back. Two places and you know lots of stuff so we kind of took that process out of it and just went okay we can do that and I don't think it's anything wrong with like taking the easy way out Bail for a DUI and then go in what they ever going there and putting that in so that's how we handle that.

It's soon simple, but we haven't found a problem with doing it's a good question. So the question is if we both 300 models and this will be just a whole lot of stuff in it in the states. Do we have any instructions? Simple answer is no we don't we stick the moon in a cell phone code Saints and they all mimic the name of the models. They see right? Otherwise kind of like how crazy are you to not do that? So well, I'll see if is it group things into logical layers? So we we we we have some photos of

gaining seeds for like the hotels so we kind of say right? Okay. Do you know I'll hotels have gone play some strange names that weed delivery south and we fixed we have to fix some stuff because we work of subdue means a lot. So kind of everything is something you do something. Like I think she'll like it that a lot of people do that. So, yeah, we kind of have fixed names for hotels and then use fake it's a kind of fake will the date that goes into it but no sitting subfolders. But you know it is it's just using some was just cool require relative in

themselves. Right? But I mean, there's nothing to really in there. It's it's it's it's a very simple but yeah. Yeah, that's a really good question. So the question is how do you say relationships where relationships are in pool? And you got lots of relationships interacting objects those kind of things. Yes. So the reason that we the reason Versi we do the use the seed cloths is so we can specifically Define which ones get created first, right? If you kind of just need a

require relative on on that directory you kind of don't have the control if I want to see these first in this one this one the isn't that the way that we kind of handle relationships again is just a bit obvious. And simple is to as a soft top of a cease-fire. We'll just load potentially like giving Hotel will create those relationships in a separate seeds form. So for instance, we would have slashed seed. / I think the old frog is the one of our seats hotels. So we kind of have slashed the old frog and then all of the

rooms for that particular Hotel Erwin that so we have multiple save files with the same name and they doing the objects, but just a different relationships. And yeah, we haven't found a better way than just basically loading that objects at the top of the seat file or just using the objects like they just to make sure that works. It works for us it was for us. So we just kind of do a lot of like looping and sometimes just take the easy way out just kind of if you'll creating these relationships just create a

relationship for everything like me and then loop around it and then create a relationship do the other things and we keep things as simple as possible because otherwise, you know, you kind of risk making this stuff complex again that your man eating a managing seeds is not really what you want to be doing day today. So that's kind of how we handle with the relationship side of it. And that's what it's simple but sometimes simple is enough. The question is do we have an issue

with seeds getting stale? The oldest answer? He's not the reason for that is because most people didn't introduce this at the Star of the Sea answer. We haven't really seen an issue with seeds, becoming Style. I imagine they will at some point as far as we're in that honeymoon phase at the moment. Where is like into a hotel bookings for the real date its prices and I know this stuff so we are at the honeymoon phase and I will talk to everybody will run to we

we have like a list of Niceville utility classical two dice and we kind of soda do dice rolls and stuff like that to in order to create some random associations in to fill out to make it to a feeling we kind of do it just play 600 Ruby Clause's to have some fun and it does your sense of joy and just general kind of programming pleasure to create these things in we've had some fun kind of you know, I was like, I'll put in the console as well as I do that so I just kind of run season wait for it like out like ridiculous fun

stuff in the console and we've got your hand crafted things. And yeah, we kind of output will be so ridiculous verbs for what we doing. Metaprogramming phone within within seeds like they much more fun than they sound. he says so the question is how we tried any gems for receding and there are quite a few see-through. I think there was another one. I can't think I'm the realest we didn't because we kind of knew what we wanted to do a little bit in Conover exploring data from call of baby, like production environment sister flouncy. We didn't

want to do that cuz we have some very sensitive. It just felt like one of those things that was that we didn't need to come over engineer and we didn't want to have a dependency. We then needed to kind of walk out. It just felt like it kind of grew quite organically just anything's better than what we've got now so we did that and then we kind of create a class out of it and we kind of went through those phases rather than so sat down and create some master plan of exactly what would Would come of it so it was much more organic than that. It's still very simple, but I think

that if if if you look at the gems and you find the gym, which is the thing that you want to do and by all means, you know, you should actually use that makes sense to spend too much time. Reinventing the wheel but for us it was good fun. It was good good little project to do and everybody involved in. Hey we can do this. This is cool. So the question is do you season I'll test files. The answer is no. And it's a simple as that I suppose you could take that day or

refuse not date you do an integration tests and stuff like that and maybe that's kind of something that we will we will look at in the future but not at the moment. I mean, we probably like a lot of people we've got like an aspect you do and we got like a ton of let's create your own Petrelli and everybody has a little bit of fun about one thing that they decide to, you know, cool though that they're so stop soil. I want not so yeah, we don't we don't do that with a little early to test the the see fireworks.

The question is do we have a guide for setting up the way that we've set it up? If you're interested in that have gone out to various blog posts at crystal soul. Cuz I was available as well. And I guess I'm going to send these lies somewhere and put those out so kind of maybe share the way that we do seating specifically and and how and how good maybe we could turn into gym and maybe we'll see what is how to go about it. nobody else okay against thank you very much. I'm Chris. If you want to come talk to me. I'm worth it. Especially

to find me somehow.

Cackle comments for the website

Buy this talk

Access to the talk “RailsConf 2019 - Reset Yourself Free (The Joy of Destroying your DB Daily) by Chris Waters”
Available
In cart
Free
Free
Free
Free
Free
Free
Free
Free

Access to all the recordings of the event

Get access to all videos “RailsConf 2019”
Available
In cart
Free
Free
Free
Free
Free
Free
Free
Free
Ticket

Interested in topic “IT & Technology”?

You might be interested in videos from this event

September 28, 2018
Moscow
16
170
app store, apps, development, google play, mobile, soft

Similar talks

Kevin Murphy
Principal Software Developer at The Gnar Company, Inc.
Available
In cart
Free
Free
Free
Free
Free
Free
Free
Free
Ryan Alexander
Back-end developer at Money Advice Service
Available
In cart
Free
Free
Free
Free
Free
Free
Free
Free
Leonardo Tegon
Software Developer at Plataformatec
Available
In cart
Free
Free
Free
Free
Free
Free
Free
Free

Buy this video

Video

Access to the talk “RailsConf 2019 - Reset Yourself Free (The Joy of Destroying your DB Daily) by Chris Waters”
Available
In cart
Free
Free
Free
Free
Free
Free
Free
Free

Conference Cast

With ConferenceCast.tv, you get access to our library of the world's best conference talks.

Conference Cast
613 conferences
24811 speakers
9162 hours of content