-
Notifications
You must be signed in to change notification settings - Fork 595
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
Unable to update columns which uses @date in model? #1804
Comments
@homocodian it seems there is an issue with the schema you have provided.
|
I have already tried that |
@homocodian how are you trying to perform the update? |
static async delete(id: string) {
await database.write(async () => {
const note = await notes.find(id);
// capture updatedAt timestamp in some global state
note.update((note) => {
note.deletedAt = Date.now();
});
});
}
static async undo(id: string) {
await database.write(async () => {
const note = await notes.find(id);
note.update((note) => {
note.deletedAt = null;
// doesn't work, even state return correct previous timestamp
//. updated_at not marked as readonly
note.updatedAt = someGlobalState.get(note.id) ?? undefined;
});
});
} Actually I am sorting query results based on updated_at, if the user deletes the note and I want that to be back at its place not at the top bcz of updated_at changed to latest timestamp, can I somehow stop updated_at column to update at certain actions such delete and undo |
I'm just going to comment on the first part of the snipped because that was the original question. The issue is that you need to pass a await database.write(async () => {
const note = await notes.find(id);
note.update((note) => {
note.deletedAt = new Date();
});
});
} However, when using the |
schema
model
changing deletedAt column to use @field works
The text was updated successfully, but these errors were encountered: