C
C
cat_crash2014-08-18 08:25:01
MySQL
cat_crash, 2014-08-18 08:25:01

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

2 answer(s)
M
Maxim Grechushnikov, 2014-08-18
@maxyc_webber

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

A
AxisPod, 2014-08-18
@AxisPod

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 question

Ask a Question

731 491 924 answers to any question