Changing note/card id (e.g. creation time)


Is there any way to change creation time of a note, or create a new note with a specified creation time (e.g. id) ? The only thing I could think of would be making a direct request to the database, which is not really beautiful. I don’t know whether it would break anything to do so, I don’t know why on rust, the features does not allow to flush card when the id is not already in the database, whether it’s only a check feature, or whether it ensure that some logic is maintened.

This would be useful at least for the add-on copy card, which can’t copy creation date anymore. (Technically, it never copied it, since ids are unique. But a difference of a few milliseconds is more acceptable than a difference of days or years)

There’s an add-on for changing the card creation date, it might be helpful: Change Card Creation Times - AnkiWeb


Distinguishing between “add” and “update” is necessary to catch cards accidentally being added when the intention was to update them - which can happen if some code tries to flush a card object which has already been deleted on the DB end. This could have been done with separate functions rather than an id of 0, but using a zero id was the easiest way to integrate into the existing code at the time IIRC.

For now you can just use sql to replace the id after a new card is added - provided you do it before the user has a chance to review or sync, it should not cause problems.