Answer the question
In order to leave comments, you need to log in
How to update a table after deletion?
I have a SQLite database with an ID (primary key) column. When an entry is deleted, for example, with ID 1, the entries in the table go further from 2 (ID 1 is empty). How to update ID after deletion? So that ID 1 has a record from ID 2, etc.
Answer the question
In order to leave comments, you need to log in
Identifiers should not change, that's their whole point.
Perhaps someone will come in handy, solved the problem like this.UPDATE table SET id = id - 1 WHERE id > ?
instead of executing the task, you can put a mark on the task in the queue, then a separate script will process the tasks
habrahabr.ru/post/123451
MySQL has two ways to store time - Datetime and Timestamp. Details about the differences in the documentation, in your case it is not critical.
Cron once per minute is the worst thing you can think of. It is better to simply store the publication date and time and add a condition to the SQL query that will discard records with a publication time greater than the current one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question