mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Error for drop against immutable database, closes #1874
This commit is contained in:
parent
612da8eae6
commit
65521f03db
3 changed files with 30 additions and 12 deletions
|
|
@ -1236,7 +1236,8 @@ class TableDropView(BaseView):
|
|||
request.actor, "drop-table", resource=(database_name, table_name)
|
||||
):
|
||||
return _error(["Permission denied"], 403)
|
||||
|
||||
if not db.is_mutable:
|
||||
return _error(["Database is immutable"], 403)
|
||||
confirm = False
|
||||
try:
|
||||
data = json.loads(await request.post_body())
|
||||
|
|
@ -1248,6 +1249,8 @@ class TableDropView(BaseView):
|
|||
return Response.json(
|
||||
{
|
||||
"ok": True,
|
||||
"database": database_name,
|
||||
"table": table_name,
|
||||
"row_count": (
|
||||
await db.execute("select count(*) from [{}]".format(table_name))
|
||||
).single_value(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue