Skip to content
This repository was archived by the owner on Apr 24, 2023. It is now read-only.
This repository was archived by the owner on Apr 24, 2023. It is now read-only.

V2 toMany relation structure support in V3 #152

Description

@AlexKMDev

Steps to reproduce: follow the quick start tutorial here, select blog template, optionally configure firebase/firestore datasource, try to add multiple objects in <relation> field and take a look at the database structure.

Currently the structure look like this:

Categories

screenshot 2019-02-21 at 10 30 48 pm

Posts

screenshot 2019-02-21 at 10 30 54 pm

As we can see Canner creates not even different relation type, but for completely wrong schema too. It happens for all types of the data source: memory, firebase, firestore.

How could this happen?

Activity

  1. changed the title [-]ToMany relations completely broken in v3[/-] [+]ToMany relations are completely broken in v3[/+] on Feb 21, 2019
  2. wwwy3y3 commented on Feb 22, 2019

    @wwwy3y3
    Contributor

    Hi @Anakros

    This data structure is actually correct but our quickstart might mislead you.

    Before @canner/cli v3.1.1, the blog example we used has one-to-many relationship on post and category. In other words, a category can only have one post and a post can have many categories. That's why you saw a postId on category data. That's how we achieve one-to-many relationship.

    We found it bizarre and misleading as an official example, so we changed it to many-to-many relationship at v3.1.1, so after v3.1.1, your data structure in firebase will look like this:
    2019-02-22 10 24 09

    You can see that to achieve many-to-many relationship, we have other two tables saving relationships from both side.

    So, don't worry. Nothing is broken here. We have large amount of tests on relationship.
    Simply upgrade to latest version, you'll see what you expect.

    Thanks!

  3. AlexKMDev commented on Feb 22, 2019

    @AlexKMDev
    Author

    Thanks so much @wwwy3y3, now it works correctly after upgrading from v3.1.10. However, is it still possible to deploy the app to Firebase Hosting the same as v2? I can't find a way in the documentation.

  4. wwwy3y3 commented on Feb 22, 2019

    @wwwy3y3
    Contributor

    Hi @Anakros

    As we announced in our blog post: https://www.cannercms.com/blog/2019/02/07/canner-v3#migration-from-canner-v2-v3

    We'll release a new feature next week allows you to create the exact same structure in v2 using mode: embed.

    <relation keyName="categories"
            ui="multipleSelect"
            title="categories"
            relation={{type: 'toMany', to: 'categories', mode: 'embed'}}
            uiParams={{
              columns: [{
                title: 'Name',
                dataIndex: 'name'
              }]
            }}
          />

    We'll also publish a migration guide for developers to transform from v2 to v3. I'll mention you in this thread as well.

    If it's okay, I'd like to change the title to V2 toMany relation structure support in V3 since the word completely broken might scare our users 😅

  5. changed the title [-]ToMany relations are completely broken in v3[/-] [+]V2 toMany relation structure support in V3[/+] on Feb 22, 2019
  6. wwwy3y3 commented on Feb 22, 2019

    @wwwy3y3
    Contributor

    @Anakros regarding deployment to Firebase, We'll add a section in document as well next week that teach people how to deploy to Firebase Cloud Function.

    Since our architecture includes GraphQL Server and the Authentication server, it's easier to deploy the whole thing to Cloud Function.

  7. AlexKMDev commented on Feb 22, 2019

    @AlexKMDev
    Author

    Yes, sorry about the title, @wwwy3y3, I've changed it myself.

    By any chance do you have any technical details already regarding deployment to Firebase or I should wait until you release it in the documentation next week?

    Thanks for your help again.

  8. wwwy3y3 commented on Feb 22, 2019

    @wwwy3y3
    Contributor

    @Anakros There are still some optimization details (for example the cloud function bundle size) we're trying out here. We really want developers to have the best experience using Canner.

    We plan to publish a blog post approximately next Tuesday if it's okay.

    Thanks!

  9. AlexKMDev commented on Feb 22, 2019

    @AlexKMDev
    Author

    Thanks, looking forward to it!

  10. AlexKMDev commented on Feb 27, 2019

    @AlexKMDev
    Author

    Hi @wwwy3y3

    Are there any news on the deployment to Firebase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions