ash-jc-allen / short-url

A Laravel package for creating shortened URLs for your web apps.
MIT License
1.25k stars 158 forks source link

Add migration to convert false tracking fields to null #272

Closed ash-jc-allen closed 4 months ago

ash-jc-allen commented 4 months ago

This PR piggy backs off the back off #244 to solve issue #243.

Currently, if the user agent parser can't detect data from the user agent string, the fields will be stored as false in the short_url_visits table. For example, if we can't detect the visitor's browser version, then the browser_version field will be saved as false.

As of Short URL v8 (to be released shortly), this behaviour has slightly changed. Instead, we'll use null rather than false.

This PR uses @stevebauman's proposed database migration that will update any existing rows that are using false to now be null.

I'm going to sit on this one for a day or so and try to get some other opinions. I'm worried about corrupting anyone's data! 🤯

ash-jc-allen commented 4 months ago

I've opted to make the migration an optional (yet recommended) step in the upgrade guide.

Just so that I can sleep easy at night without worrying that I've messed up anyone's data, I'll let the developer explicitly make the decision to convert the data themselves haha! I'm not sure if this is the right decision, but I couldn't quite make my mind up.

So I'll close this one for now 🙂