The most Dense of all Updates

Post #245 written by Khodok in Huge Updates

Content

She’s a dense one this one!

Actually it’s a lie I’ve updated a LOT of stuff in the last few days and all count them as part of this one. The reason I did is because of the first part of this update!

SQL Update!

What changed

So this is very much the most uninteresting part of it for y’all but it’s cool… since I’ve been trying to do it for a really long time before always getting stuck at the next step.

  • The website now uses MySQL instead of SQLite, the reason: I wanted to use MySQL for a long time, but here is the friction log for this part:

SQL Update Friction Log

Disclaimers

  • Everything fucked up at least once…
  • And this is the story… not of Jägermeister… but of I believe 8 months of struggle.
  • Also the story below is mainly meant for people knowing what a PK and CSS is, if you don’t understand, try to, or don’t, or ask me I’ll try to explain.
  • I still simplify a lot of it though, if I went through everything (I couldn’t cuz I forgot half of it), it would be impossible to understand for anyone, and it would be long af for nothing, or well, longer than necessary for nothing.

Chapter One: The Problem

I first tried to switch to SQL a few months after I started this blog, before I was also considering it, but never actually tried because it wasn’t a priority for me.
I decided to try a few online tools to migrate the website’s data from SQLite to MySQL (remember that at that point the website was WAY simpler).
Some worked, some seemed not very good, some were just a big fat no from first look.
The ones that worked always came with ONE problem… whenever I was using my website after migrating, all new entries were starting with an auto-incremented PK of… 1 thanks to InnoDB having this weird setting of starting from 1 if the server is restarted? (whatever that means).
At that point I said: well, from this it’s probably an easy fix, I’ll do other stuff and finish this in a few days… which I did, except it wasn’t that easy…
I was still learning, I was still learning Django, of course, but also stuff that you might think a computer scientist should know… like how to easily use SQL… (believe me, when you don’t get the loving spark with SQL, it’s kinda like CSS for pretty much everyone… the WORST of things… a tool you HAVE TO use, but really don’t want to, (I do like CSS a lot though)).
This made me have one big trouble, I didn’t know how to find what data I had to change to just fix this… what I didn’t know at that point, is that anyway this wouldn’t have fixed anything 😂
So I searched the internet in a quest for answers… and I found a lot of answers… just none of them were THE fix for my problem…

Chapter Two: The Stampede

I gave up… SQLite was good enough… I was starting to learn how to use it more and more, had found a data visualization tool for SQLite that was offline only (so no problems with risking data), etc (if anyone wants it it’s DB Browser for SQLite, it’s probably not the best of all, but it was just what I needed).
I then continued using my SQLite thing, it was enough, I decided I’d stay… but then a new problem hit… the SQLite file was slowly becoming massive, it was still small for a Database, but sometimes a change in the app could add a few hundred kilobytes of data pretty fast, which again wasn’t much, but made it for some reason really stressing, I really started to believe it could just grow a few hundred MB in a night if some of the random Russians trying (and never succeeding lmao, thanks Django) to hack my website decided to just spam a data, which would have easily filled my host… which would have been kinda sad if the only data I had was an SQLite file, a few thousands lines of code, normal OS stuff and static files 😂

Chapter Three: Round Two!

This is it! I’ll migrate to SQL… this time I still had the +1 problem, but I decided that if I could make it word I’d just recreate every single data by hand (or well doing it for the first few hundred things and then start looking to make a script).
Problem… I hit another wall… I managed to make it work, pushed to my host… and it stopped working… nice, I had been trying for a few hours, I took the commit before this one and gave up.
This section… happened in a loop for a few months, it was mainly the one problem I hit.

Chapter Four: OMG I did it !!

This time I was annoyed, I was tired before I started, and I decided to try to wake my neurons up, which btw, didn’t work, but Idc, the process worked.
I do my migration, hit the first wall, try something else, IT WORKS… the simplest of fixes, that I had tried a few times, only I often tried it when my brain was already dead and so I always missed the part where it worked, except once, I saw it did, but I had been trying for so long that I gave up anyway and forgot I managed to do it, kinda sad… but eh…
I hit the second wall… WAIT… never had this problem, now it’s when I get my data from the generated json file of data, I get a message saying that some data had the wrong character encoding… oh no…
I search the web, find out that I have to use thi- no th- NO THIS ONE! (tried 4, always had to redo the whole process lmao).
Oh well, this one works… except for this
Oh this one does too, but omg one of the last migrated data has an emoji from an Apple device… which also fucks everything up
Well anyway, managed to get it working, but then! oh no… something else breaks, I can’t migrate new changes from my models, I can’t do this or that, hum but why? oh… the database needs this encoding, but I also have to specify in my code that it needs this encoding, plus that…
Finally everything works in local…

I push it to the server…
Breaks… why? oh the encoding I used has been added in MySQL 5.6… so it… wait I’m using MySQL 5.7, why does it break? oh because for some reason (I still don’t know why), it also needs to work with MySQL 5.5, even if I don’t use it, well alright, I’ll do like before, give a basic encoding and tell in the code it can actually use more, but even more specific this time, it worked too!!!

Ok now problem, I got my whole thing to work, but I still haven’t tried to actually migrate the data I needed to migrate, only tried to see if it could work.
Breaks again… OMFG! (fuck this post is already so long).
Ok so what happened?
Well it wasn’t actually that bad, the problem was easily fixed when I saw the error message which was, for once during this whole problem, explicit enough.
I just had to tell to my database, and all its tables, that they weren’t using the encoding they were given, but the more explicit one, which could only be done after because of the weird problem with MySQL 5.5 I talked about just before.

It. Finally. Works…
I go on my website, try stuff, and nothing breaks.

Epilogue: Few days trying it

I haven’t immediately posted about it because I wanted to try and see if it wasn’t going to break stuff in an unexpected way, so I continued updating stuff and literally changing a crap ton of data every day to see if pushing it to the limits would break it. It hasn’t. but now are all the updates because of this…

Modules update

What’s new

  • Modules
    what are they? you may ask, well… GLAD YOU FUCKING ASK!!!

This is very much for me only, yet anyway, but here we go

  • Basically I can manage side menus (currently only side menus), in the admin Panel, no need of changing the code anymore, I could ad 25 side menus if I wanted, which I won’t.
  • You may find this dumb af and useless as possible, considering two of them are still hard coded… well true, currently, it’s useless, but don’t worry.

What changed

  • Nothing

What’s next for Modules

  • For now a side menu can have links, a title, a sub title, be of the type user side menu or the type post list side menu, the two last being probably hopefully only temporary done that way, we’ll see…
  • A side menu can be part of a Settings Presets, one of them can have side menus, a default template, and later more stuff to finally reach their use: being able to easily modify the whole website in a few clicks.
  • One of the links in a side menu can be given a required permission, a staff member or an admin if necessary, if these are activated, they’ll only be visible if the person logged can or not see them. This will be upgrade so it can also need two of them and also more type of requirements, like roles, which should be added asp.
  • A link can also be given a color, but later will have more parameters, like a group (it already has that, except it does nothing), which would then put all the ones with the same group in a button group and divide the groups, etc.
  • And also… currently this is only side menus, a few links and some other stuff… The point is to make at least 95% of the hard coded displayed data on the website that way… WebFlow will sound like child play next to that.

Search update

This is smaller, but still kinda cool, Dark, you owe me something (well actually I did it for myself and for everyone too, but you’re the one who started me with this dumb search shit)

What’s new

  • You can now go to search which leads to a list of specify search lists, currently three, either Posts, Comments, or Everything (everything being Posts and Comments 😂)
  • You can go to this page either by clicking the Search label next to the search bar at the top, or by adding /search in the url bar of your browser after the domain.
  • Searching in the search bar searches in Everything by default.

What changed

  • Well search in itself changed…
  • Probably make it less… bad overall, I mean currently it’s really not well done, searching in all shows EVERYTHING on one page and it’s… damn… oof it’s a lot…
  • Also maybe make it its one app, Idk…

Other updates

  • A lot of small bug fixes.
  • Changed some stuff that were not very well done in my code.
  • Decided to name same fields with same names so making the Search part was way easier (title fields are all titles and not sometimes title, sometimes name, and sometimes nothing.
  • Talking about that, comments can now have a title if you want to, people with accounts can if they want edit their old comments to add titles, note that titles aren’t even showing except in Search currently lol. and if a comment doesn’t have a title it’s replaced by the whole thing like before: related post, the author, and its id, the title is also in the middle if a title is given though. but that’s details
  • Some useless fields were removed and now use more maintainable stuff, that’s mainly for me too.
  • All Forms now have a margin of 2 pixels above their submit buttons (which all have been renamed as well) because it broken when I started using Bootstrap 5.
  • Other tiny changes with no difference for none of use.

This post probably has a lot of not very clear stuff, don’t worry, I started fresh, now I’m tired… damn it’s the first 8 mins read time post I fully write myself I think… and it became 9 minutes because of this line lmao.

Comments

Please Log in to leave a comment.