More Git for schema refresh

Conrad Slimmer · Friday Demos · November 22, 2024 · 8:41

More work to make sure everything in Omni can go through git, including schema refresh

Transcript

This transcript is auto-generated. Names and product terms may be wrong.

  1. I'll, uh, share what I've been working on. I can find the share button on this computer here. We'll just share Chrome, and hopefully that's enough. Okay, I have a couple of features that are really related, and I've already done a soft demo of this before, even before we knew it was going to be an independent feature. But I'll start with this one because it's much more reliable now, and it's actually very close to launch.

  2. So, uh, you can see that I'm on the connection page , and we have this new toggle for updating the schema based on branches. So before I showed it, it was, uh, unfinished and wasn't really a setup, and it was just supposed to be the basis for the other part that I'm going to show in a minute, which is git without pushing to the master branch by default.

  3. So now, regardless of git, regardless of whether the model is configured for git or not, I can enable branch-based schema updates. And if I do that, uh, and oh, we'll show a few things here. First, this will disable schedules, as the schedules will be on the main wiring diagram model, not in the branch. And that will also, uh, ban the API now.

  4. Eventually, we will add the ability to create branches via the API and then pass the branch parameter to the schema update API . So you can still do things like that programmatically with them. Uh, this will also be the default, uh, this will also disable the refresh button on the connect page , because the connect page has no context of what branch I may or may not be in in a given model.

  5. So, now that I have this set up, I can go into the IDE, and from here I will need to perform a schema update. And I made it, uh , convenient. So if I wasn't in the branch, it wouldn't show this branch entry stream. But since I'm not there, it's going to , uh, ask me to create a branch name.

  6. And when I do that, I run the same schema update in the background, but it's only related to that branch. Uh , just to show that I actually did something, and actually did it at the branch level. You see, I've already added a new column to my test database. So I have this test column 4 if, uh, and it's ready to create a pull request.

  7. I actually set up git. So, to show the complete process, we will create a pull request. Uh, you see the only difference is that I added this field. And I'm going to merge this pull request. And we can delete this branch. And if we come back here and, uh , exit the branch, we'll just show that, hooray, my new field was promoted, uh, through this pull request .

  8. So that's great. Well, now we're going to show another part of this feature that I haven't shown before, which is ...and, oh, also, while I'm in the middle of this, thanks to Jared and all our friends on the design team who are always happy to come in and make, uh, my frontend garbage look like not garbage. So Jared helped out yesterday with the push of some git stuff, the git settings page.

  9. And you can see that we have this new toggle that is nested under " pull request require" . Some of the terminology here is, uh, still being considered. But, uh , if I enable this feature, we 'll never commit to the git master branch again. uh, which has been a problem for some people because they want to use best practices like, uh, setting up branch protection on their master branch, and actually requiring pull requests for every action.

  10. So now that I, uh, turned off automatic syncing, essentially to the master branch, and I showed, I showed branch-based schema updates , because that's actually a requirement for this setup, because if we weren't doing branch-based schema updates, which changes the model, the shared model underneath it and; and so to support this, like "hey, we're never going to sync Omni to the Git master branch", you need to enable branch-based schema updates .

  11. Now that I have that set up, let's just imagine that I somehow go into my Git repository and just pretend that someone went in and made a commit directly in the master branch, or somehow the master branch got out of sync with what's in Omni. So, to simulate, we'll go in and someone will be feeling really destructive, so they'll delete a bunch of fields in the master branch of one of my view files.

  12. Now, if I go back to Omni, and the next time I do something here , creating a new branch might not work, but when I commit, uh, any action that interacts with the Git repository, like creating a merge request, should work if everything is working as it should. Oh, look at this. So now we would overwrite the changes I made in the master Git branch with what is actually in Omni.

  13. But instead, we mark the shared model as out of sync with Omni. So, if your shared model, the Omni shared model, is not in sync with the master Git branch, you will get this banner. And hence merging any poll request at this stage will bring it back into sync. But probably the best thing to do is just create an empty branch in Omni, and from there create a pull request.

  14. And if we look at this pull query, you'll see that all it does is restore all the deleted fields. Oops. And I'm going to merge this pull request. And once I do that and get out of here, you'll see that my sync warning is gone , because main is now synced to Omni via the pull request thread .

  15. Hmm, this is really close to being finished. Um, basically you need to write tests, and, uh, I'm looking forward to seeing it become a reality because I've been promising it for too long. Um, I have a very small template that I can show that was actually designed by the client, but I think I have a good design template.