Answer the question
In order to leave comments, you need to log in
Yii: how to properly reduce ID on insert?
Good afternoon.
The base scheme is such that there is a need to insert new data models with a decrease in ID, in other words from 0 to minus Int64. Base - mysql
Question - how to implement this?
Answer the question
In order to leave comments, you need to log in
I saw all sorts of perversions, konesh. but can still make one more field and increment it? it would be more logical for posterity.
and on the topic, do not forget that this must be done with transactions
Isn't it possible to put a minus sign in front of the field during the selection and not worry, at worst, here are 2 options:
1. make a view that will issue id with the sign -, the problem is with the conditions.
2. make a normal auto-increment field, make a second one next to it and set it as a trigger
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question