You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have multiple tables lets sat A, B and C.
There is no relation between them. I want to delete all the content of table A but table B and table C should be remain as it is.
Delete all content meaning the table should be empty with holding its schema.
I tried below code but it is not working,
Inside Modal of Table A @writer async markThisDeleted() { await this.destroyPermanently() }
and that calling it explicitly in other file const deleted = allContents.map(async (content: any) => await content.markThisDeleted()) database.batch(...deleted);
But this gives error that database,batch should be inside the writer.
If I write above code inside writer: const deleted = allContents.map(async (content: any) => await content.markThisDeleted()) database.writer(writer => writer.batch(...deleted))
It gives waring that there are two writers in queue.
Moreover, there is not change in database. I can see all the content there.
Can anyone help me with this issue?
Versions:
Watermelon db : 0.24.0
React Native: 0.67.2
The text was updated successfully, but these errors were encountered:
Shunshine07
changed the title
How to delete content os table?
How to delete content in table?
May 27, 2024
I have multiple tables lets sat A, B and C.
There is no relation between them. I want to delete all the content of table A but table B and table C should be remain as it is.
Delete all content meaning the table should be empty with holding its schema.
I tried below code but it is not working,
Inside Modal of Table A
@writer async markThisDeleted() { await this.destroyPermanently() }
and that calling it explicitly in other file
const deleted = allContents.map(async (content: any) => await content.markThisDeleted()) database.batch(...deleted);
But this gives error that database,batch should be inside the writer.
If I write above code inside writer:
const deleted = allContents.map(async (content: any) => await content.markThisDeleted()) database.writer(writer => writer.batch(...deleted))
It gives waring that there are two writers in queue.
Moreover, there is not change in database. I can see all the content there.
Can anyone help me with this issue?
Versions:
Watermelon db : 0.24.0
React Native: 0.67.2
The text was updated successfully, but these errors were encountered: