Chaosthebot / Chaos

A social coding experiment that updates its own code democratically.
http://chaosthebot.com
MIT License
2.44k stars 210 forks source link

Implementing the DB stuff #497

Closed rudehn closed 7 years ago

rudehn commented 7 years ago

This introduces the database into chaosbot. Currently on my fork, the issue commands and meritocracy tables are implemented and working, and those are provided with this PR.

The API for the database ORM is pretty simple. See here for a quickstart to doing various operations.

Hope you all enjoy! This took a surprising amount of work to get implemented.

anythingbot commented 7 years ago

Looks fine, but github says you have conflicts, so downvoting until those are resolved.

rudehn commented 7 years ago

Yeah it's a big update and a lot of stuff is conflicting. Looking to finish this up tomorrow.

rudehn commented 7 years ago

OK not sure why this got screwed up when I did the rebase. The DB stuff is tested and working. I would appreciate advice on how to clean this stuff up.

rudehn commented 7 years ago

Yeah it's been WIP for a few days, so when I resolved the conflicts, it updated literally everything. Not sure if there's a way to get around that.

mark-i-m commented 7 years ago

This could be very messy if you try to merge it I think... I've seen things like this happen which actually really messed up the git history of master. I would recommend generating a patch with the diff between your branch and chaosbot master. Then apply the patch on a fresh branch and submit a new PR.

rudehn commented 7 years ago

Sounds good @mark-i-m. I've decided to leave it WIP until I can figure out how to clean it up. I'll try your suggestion

PlasmaPower commented 7 years ago

I'll see if I can clean it up for you.

andrewda commented 7 years ago

@mark-i-m Yea, you're right. That's probably the cleanest way to go about it.

rudehn commented 7 years ago

Thanks @PlasmaPower, appreciate it.

A task still to do is migrate the current data into the db.

PlasmaPower commented 7 years ago

@rudehn done! To apply my branch:

git fetch https://github.com/PlasmaPower/chaos.git db-rebase
git reset --hard FETCH_HEAD

From there, check that everything looks right, then git push --force to push it to GitHub.

PlasmaPower commented 7 years ago

A migration script isn't a huge deal right now, worst case a couple of comment votes get dropped and the meritocracy gets mentioned an extra time.

rudehn commented 7 years ago

Hey it worked! Thanks! How did you do it?

PlasmaPower commented 7 years ago

~A magician never reveals his secrets~

  1. checkout and pull master
  2. create db-rebase branch
  3. fetch your branch so I can get commits from it
  4. cherry pick commits from this branch, ignoring ones that are changes on master
  5. push
PlasmaPower commented 7 years ago

To list the commits, I used git log of course.

PlasmaPower commented 7 years ago

Oops looks like I missed a commit?

PlasmaPower commented 7 years ago

Or was that a local change? I think so.

rudehn commented 7 years ago

No that was a merge error on my part.

rudehn commented 7 years ago

This is just waiting review now. I can un-WIP if needed.

chaosbot commented 7 years ago

:white_check_mark: PR passed with a vote of 11 for and 1 against, a weighted total of 10.0 and a threshold of 6.5, and a current meritocracy review.

See merge-commit a42223ef9696f5401501fd5f0ef90d80303653b8 for more details.

PlasmaPower commented 7 years ago

For the record, this resulted in all issue commands revoting, as expected. There were a lot more than I thought though.

andrewda commented 7 years ago

... And it's repeating.

rudehn commented 7 years ago

I've created a monster.

I'm not sure what the exact issue is, but it's one of the following