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

How to place an Auto-increment id in v3.1 #464

Open
sharan1 opened this issue Feb 6, 2020 · 1 comment
Open

How to place an Auto-increment id in v3.1 #464

sharan1 opened this issue Feb 6, 2020 · 1 comment

Comments

@sharan1
Copy link

sharan1 commented Feb 6, 2020

when we updated factory muffin from v2.1 to v3.1

For auto-incrementing ids, we used to use the following function:

function () {
        static $last;
         if ($last === null) {
             return $last = 1;
         }
         return ++$last;
}

But after upgrading the same function always started returning 1, resulting in errors for duplication of primary key in our test database.

Any idea what could be the issue and how to resolve it?

Originally posted by @sharan1 in #382 (comment)

@GrahamCampbell
Copy link
Member

Thanks for the report. I can't quite remember why this would have been broken. I'll have a think. ;)

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