-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Fixed bug where the reference_fields were used as id #12
base: master
Are you sure you want to change the base?
Conversation
…ot supposed to be This caused different schemas to use the same counter, despite having different id's for the counters, but the same reference_fields.
1 similar comment
Ok, have no idea what the last error is about... It's not the code, it's the test file. |
Ok, I don't understand very well the problem. By the way, I saw master was very old while I had a ready release. So I did a release (which in turn maybe solve the problem you are facing). Let see if your patch still applies and in case can you create the PR against |
Ok, in the version which is on master now, after publishing it, the problem should be solved. The reference_field is not used anymore as id to lookup on the counter collection. The proper id is always used. "Two schema use the same reference fields for a sequence. The counter must not be shared between the schema" |
Here is a scenario to test against:
Both schemas should have a separate counter, that is also dependent on the company on each schema. Company#2: Company#1: Company#2: |
I can see in master now that the id is indeed as it should be. One way to fix that is by replacing this:
With this:
|
the |
Yeah, but what if two counters have specified the same id field but different referencefields? |
The id unicity (for sequences) is delegated to the developer. What if, on db, there are the different reference fields with the same name too? The problem remains.
Is there a case I'm not seeing? |
Sorry, I'm starting to see what you say. Let me add a test to be sure |
PS, I like describing the software constraints through tests as you may have understood |
@ramiel Sorry for the delay, yeah I totally understand the need for tests. Did you manage to create a test for the scenarios I described here? |
I think your boss is right. You just have to tell it to me and I'll provide :) |
Even though they are not supposed to be.
This caused different schemas to use the same counter, despite having different id's for the counters, but the same reference_fields.