feat: mark all existing migrations complete on fresh install
Problem
Sometimes it's tricky to provide a good check against existing vs new installs.
Keep the old code around for migrations that must have been completed on previous PostHog versions means we need to keep updating the is_required requirements, which is a waste of time.
Related discussion here: https://posthog.slack.com/archives/C0374DA782U/p1661249227530259?thread_ts=1661244132.132639&cid=C0374DA782U
Changes
Instead handle the fresh installs don't need to run any existing migrations separately and then we can nuke all the code. Note that I opted for doing it in setup, rather than using the 0001 migration as that's more logical and readable.
Also removed the warning about skipping async migrations setup as we skip them on worker and we don't warn about system requirements, which is roughly equally important.
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?
Tested locally by marking 0001 and 0002 as not started.
update posthog_asyncmigration set status=0 where id=2;
update posthog_asyncmigration set status=0 where id=1;
With 0 event count the migrations got marked as completed and PostHog started up fine.
With non-zero event count saw an error
Stopping PostHog!
Required async migrations are not completed:
- 0001_events_sample_by - must be ran on PostHog version 0.0.0 up to 1.33.9
A lot of code conflicts!
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.
This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.