pocketbase icon indicating copy to clipboard operation
pocketbase copied to clipboard

Remove migrations and all tests for compatibility with v0.23.12

Open CanGonenc opened this issue 1 year ago • 6 comments

Removes migrations and all tests, this is needed for compatibility with new version v0.23.12 since the migrations import from github.com/pocketbase/pocketbase/models and github.com/pocketbase/pocketbase/daos which do not exist in v0.23.12. The current state breaks builds so I created this PR for you to quickly do a temporary fix, obviously the migrations and tests should be restored later once it is compatible.

CanGonenc avatar Dec 27 '24 15:12 CanGonenc

@benallfree could you please check this out? I am a bit out of time for this currently and since you did the v23 migration PR maybe you can confirm to merge :)

pluja avatar Dec 31 '24 09:12 pluja

@CanGonenc Do you mean there is something special about v0.23.12 exactly, or just v0.23.x?

Can you provide more information please? We already have v23 compat with passing tests, don't we?

benallfree avatar Dec 31 '24 11:12 benallfree

Sorry the description wasn't clear, I encountered the problem and struggled to debug and fix it for 3 hours so I was frustrated so I hastily created the PR so that other people having the same issue dont have to figure it out themselves. The problem is not with v0.23.12 specifically, the problem is with the tests not being compatible with the v0.23.x version (they are importing github.com/pocketbase/pocketbase/daos and github.com/pocketbase/pocketbase/models which are removed in v0.23). Which results in an error when go get -t "github.com/pluja/pocketbase" (which gets and builds the tests, so no problem only breaks when trying to build tests) and more importantly when go mod tidy is run with the go.mod package including both pluja/pocketbase and pocketbase/pocketbase (because go mod tidy apparently tries to build the tests in this scenario?? idk why exactly):

sample go.mod which errors with go mod tidy:

module main

go 1.23.4

require github.com/pluja/pocketbase v0.1.0

require github.com/pocketbase/pocketbase v0.23.12

Error message after go mod tidy with go.mod file including both pluja/pocketbase and pocketbase/pocketbase:

go: finding module for package github.com/pocketbase/pocketbase/daos go: finding module for package github.com/pocketbase/pocketbase/models go: test imports github.com/pluja/pocketbase tested by github.com/pluja/pocketbase.test imports github.com/pluja/pocketbase/migrations imports github.com/pocketbase/pocketbase/daos: module github.com/pocketbase/pocketbase@latest found (v0.23.12), but does not contain package github.com/pocketbase/pocketbase/daos go: test imports github.com/pluja/pocketbase tested by github.com/pluja/pocketbase.test imports github.com/pluja/pocketbase/migrations imports github.com/pocketbase/pocketbase/models: module github.com/pocketbase/pocketbase@latest found (v0.23.12), but does not contain package github.com/pocketbase/pocketbase/models

I have a project with a go module which has both these packages imported and it took me hours to figure out what was happening, I managed to fix the problem by removing all the tests and decided to create a PR for a temporary fix for other people depending on both packages, since currently a project with both packages cannot be upgraded to github.com/pocketbase/pocketbase v0.23.x

CanGonenc avatar Dec 31 '24 14:12 CanGonenc

@CanGonenc The tests in master are passing when make test runs.

If I'm understanding you correctly, the issues you're reporting are:

  1. This lib fails to install when go get -t is used
  2. This lib breaks go mod tidy

Is that right?

If you have time, please open an issue and provide a minimal repo that reproduces the issue.

Meanwhile, I'll leave this PR open so people can see your solution but it won't be merged because disabling all the tests is not the solution :)

benallfree avatar Dec 31 '24 16:12 benallfree

For others who run into this issue, here is the solution.

v0.1.0 of github.com/pluja/pocketbase points to a older commit which does not have 0.23 support. Simple pinning github.com/pluja/pocketbase to latest commit SHA in your go.mod file would solve this issue.

❯ go get github.com/pluja/pocketbase@adc8ee954bd6e2c95e9b969c4595db89f24a2417

prasanthkrishnan avatar Jan 11 '25 20:01 prasanthkrishnan

For others who run into this issue, here is the solution.

v0.1.0 of github.com/pluja/pocketbase points to a older commit which does not have 0.23 support. Simple pinning github.com/pluja/pocketbase to latest commit SHA in your go.mod file would solve this issue.

❯ go get github.com/pluja/pocketbase@adc8ee954bd6e2c95e9b969c4595db89f24a2417

This is the correct and easiest fix for people having the issue. The true fix is bumping version number to v0.1.1 obviously, i will keep the PR open for people to see the quoted comment until version is bumped to v0.1.1.

CanGonenc avatar Jan 11 '25 20:01 CanGonenc