Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing collections fails because of View Collections #2044

Closed
ttofis opened this issue Mar 12, 2023 · 3 comments
Closed

Importing collections fails because of View Collections #2044

ttofis opened this issue Mar 12, 2023 · 3 comments

Comments

@ttofis
Copy link

ttofis commented Mar 12, 2023

Importing Collections through JSON files on a clean pocketbase installation fails due to the data validations of the SQL request for View Collections.

The error it provides is it not being able to find the collection that you are looking for, even though it will be created by the JSON you provided.

A workaround I've been using is deleting my View Collections, importing, and then re-importing everything with the View Collections included.

I am guessing in situations where a View Collection requests data from another View Collection, that won't work. Maybe the SQL rules should be evaluated after all of the tables have been created?

Thanks for this amazing project!

@ganigeorgiev
Copy link
Member

I found the culprit. The view is actually evaluated after the collections insertion, but the problem is that the view query relies not on the collection entries but on their related record tables, which at the moment are synced at the last step of the import.

I'll push a fix sometime later today and will update the tests.

This could also explain reported issue in #2012.

@ganigeorgiev
Copy link
Member

Should be fixed in v0.13.3 release.

Note that in case of a view referencing another view the order of the imported collections still could matter because there is no easy way to partially validate the views (the view create query is either persisted or not).
This is not an issue with the base and auth collections because the integrity checks are performed after their related record tables are created/modified.

@ttofis
Copy link
Author

ttofis commented Mar 12, 2023

Excellent! Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants