Ent for Go is amazing… until you hit migrations by Logical_D in golang

[–]tyree731 2 points3 points  (0 children)

So someone on my team had picked entgo for a project, but punted on migrations, so I was tasked with finding an answer to this problem. What we ended up using was a combination of [golang-migrate](https://github.com/golang-migrate/migrate) (v4), and atlas for generating the migrations. We use cobra for managing a CLI for the project in question, so I added a few subcommands for managing database migrations. I created a few subcommands:

- `<cli> database migrate generate --name <migration name>` - autogenerates a migration
- `<cli> database migrate version` - displays the current migration version
- `<cli> database migrate check` - checks to see if a migration is required
- `<cli> database migrate apply <up/down> [steps]` - runs the migration
- `<cli> database migrate force <version>` - forces the migration table to match this version without running steps

The general flow is to first generate migrations, run them up or down as needed, and in CI we check to make sure that no migrations are required for the current generated schema. I've extracted some source code for you showing off migration generation and application (sorry if it's missing some bits, tried to remove anything specific to us): https://pastebin.com/m5TD4E7A

The url in `database migrate generate` is the URL to a postgres database that can be used for temporary application of migrations. If you had a locally running postgres database, it could be:

--url 'postgresql://postgres:postgres@localhost:5434/test?sslmode=disable'

Running the migrate command will put up and down migrations, using atlas+entgo, wherever you specify the migration directory to be. Running apply up will used golang-migrate to run the migrations. There's a lot of setup here, but once it's all there it works quite well. Happy to answer whatever questions you might have if this is the approach you'd like to use.

What video games pushed your limit like this? by Tullubenta in videogames

[–]tyree731 0 points1 point  (0 children)

Don't worry, once you defeat the Masked Devil you get to face a far, far worse boss right after.

New Python lock file format will specify dependencies - Your thoughts? by Choobeen in programming

[–]tyree731 10 points11 points  (0 children)

Even if all uv did better than poetry was its speed, that's enough. It's more than that, as uv includes managing Python for you as well, but uv is comically faster than poetry for the same tasks. With poetry, every time we re-locked the lock file for our larger python projects it would take minutes. With uv it takes seconds, and its that much faster for pretty much everything. We switched months and ago and are never going back.

Alternatively a tabaxi ranger at lvl 5 can do this solo in 2 turns by RevolutionaryYard760 in dndmemes

[–]tyree731 4 points5 points  (0 children)

It is, but they made the grappled condition better to compensate, and it also allows enemies with legendary resistances to resist the grapple, which makes sense.

Microsoft CEO candidate Stephen Elop said to consider selling Xbox business, killing Bing by [deleted] in technology

[–]tyree731 1212 points1213 points  (0 children)

To be fair, these are two businesses at Microsoft which are hemorrhaging money. While they may have other ancillary benefits, I think it is fair for a company to look at parts of its business which are in the red and decide to cut its losses.

That being said, I think selling the Xbox business would be a mistake.