Skip to content

Deleting the content of a table #341

Answered by noam-honig
OriBennett asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @OriBennett, although there is no built-in way of doing that, it is very easy to implement yourself.

Checkout the following article on how you can perform database operations directly:
https://remult.dev/docs/running-sql-on-the-server.html#using-the-underlying-database

In short, if it's an sql database, here's the code:

SqlDatabase.getDb().execute(`truncate table ${repo(City).metadata.dbName}`)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by noam-honig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants