surrealdb / surrealist

Surrealist is the ultimate way to visually manage your SurrealDB database
https://surrealist.app/
MIT License
1.08k stars 83 forks source link

remove field from a table #234

Closed mrpanam closed 5 months ago

mrpanam commented 5 months ago

Describe the bug

i have a table product with a column ( field) risks, that i want to remove

Steps to reproduce the behavior:

  1. Go to 'query' and execute remove field risks on table product

Expected behavior field should be removed from table

Environment:

Platform: Desktop OS: Windows_NT Architecture: x86_64 WebView: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0 Version: 2.0.3 Flags: featureFlags: false, models_view: true, apidocs_view: true, themes: false, newsfeed: true

macjuul commented 5 months ago

How are you currently checking which fields are defined in a table? Additionally, does it work when executing the same query via the CLI?

mrpanam commented 5 months ago

see below

image

image

macjuul commented 5 months ago

This is actually how the REMOVE statement works in SurrealDB, as it will only update your schema, not your data. If you want to remove the fields from your records you can run the following query

UPDATE product UNSET risks;