Commit Graph
20 Commits
Author SHA1 Message Date
Joshen Lim eeacb973f8 Add warning in SQL editor when running alter db commands which prevents connections to the DB (#43584)
## Context

Adds a warning if running an `ALTER DATABASE` command that prevents
connections to the database. This would lock the dashboard out of the
database, and re-configuring the setting will require a direct
connection to the DB

<img width="623" height="535" alt="image"
src="https://github.com/user-attachments/assets/4c388f4a-753b-4fd6-89c5-89dfaa52c859"
/>

## To test

- Could try running the following command in the SQL editor to check the
warning, this will show all the warnings
```
ALTER TABLE colors2 drop column sss;
update colors set name = 'test';
alter database postgres connection limit 0;
```
2026-03-11 15:34:54 +07:00
Ivan Vasilov f3af2c3d3c feat: SQL Snippets (#41112)
* Use the .sql suffix when generating ids.

* Fix a bug where a new snippet would not show up in the snippet list until refresh.

* Add API routes which serve file snippets.

* Refactor the renameSnippet and moveSnippet to work with file snippets.

* Change the link to the SQL Editor.

* Minor fixes from CodeRabbit.

* Check the file/folder name for invalid chars.

* More fixes from CodeRabbit review.

* Fix minor issues.

* Use zod to parse the snippet ids when deleting.

* Try to fix snyk issue.

* Add validation to the GET content index route.

* Minor fixes.

* Show create a new folder, it was hidden by mistake.

* Add SNIPPETS_MANAGEMENT_FOLDER env var.

* Add snippets folder in the docker-compose.

* Add error toasts if the env var is not set.

* Add snippets management folder to the generateLocalEnv script.

* Revert the docker-compose changes, will be done in a followup PR.

* Revert also the snippets volume folder.

* Remove unneeded line.
2025-12-23 12:09:37 +01:00
Ivan VasilovandJoshen Lim 5fb5acc0b9 chore: Refactor the generation of ids for snippets (#41264)
* Add a generateDeterministicUuid function and tests for it.

* Use the new function and generate an id automatically when creating a snippet.

* Clean up extra code.

* Don't pass in id when creating a snippet.

* Add generateSnippetTitle function and use it instead of fixed string.

* When SQL editor is open, generate an id form a generated snippet title.

* Add id override for SQL editor to avoid flash when saving the snippet.

* Merge the two generate functions to happen in the same useMemo block.

* Save the snippet to the API when adding it.

* Minor fixes from CodeRabbit review.

* Hide new folder CTA in sql editor for self-hosted

* Don't add the snippet for saving, just set the value.

* UpsertContentPayload always has an id.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-16 09:43:59 +01:00
Joshen Lim 3487831a48 Fix unnecessary GET content request when writing a new SQL query (#35709)
* Fix unnecessary GET content request when writing a new SQL query

* Gracefully handle landing on a snippet id that doesnt exist
2025-05-18 22:26:06 +08:00
Alaister YoungandJoshen Lim f6d9617413 chore: paginate user content (#30675)
* chore: paginate user content

* progress

* loading states

* add load more buttons to private snippets

* working pagination

* fix some types

* always show snippet counts

* support new api parameters

* favorite snippets

* progress

* searching

* paginate root folder

* fix renaming snippets

* fix ts

* removed unused prop

* Shift sharing/unsharing query logic outside of valtio to leverage on RQ only

* Fix invalidation on an unsaved snippet

* Clean up

* Fix

* Clean up

* Update API type

* Update API

* fix duplicate snippets error after moving a snippet

* add currently selected snippet

* Fix unsharing a snippet that has yet to be opened

* i'm dumb

* fix sharing a snippet

* fix sharing and unsharing

* show favorite or shared snippet in list even if it's in another page

* Fix wrong import for debounce

* Fix false positive toast error when creating custom report

* Update API type

* Change create new snippet CTA to link back to /new with skip flag

* Fix saving logs explorer query

* Bump page number

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-12-19 16:08:14 +08:00
8b90d416ec Add inline completions to SQL Editor (#30706)
* monaco complete

* progress

* just add panel to sqleditor

* update panel and prompt

* adjust prompt

* clean up

* clean up and improve prompt

* update prompt

* refine prompt

* remove package

* use constants file

* revert v3 prompt

* combine diff action bars

* use widget

* refactor

* Some updates

* fix: useCompletion base path

* fix: typo on monaco action label

* feat: use entire selected line(s) for inline completions

* fix widget consistency

* widget styling

* Fix TS

* feat: lock llm model version

* fix enter key issue

* move complete endpoint

* update complete prompt

* remove file

* placeholder text

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Greg Richardson <greg.nmr@gmail.com>
2024-12-17 15:02:06 +10:00
Joshen Lim f87c2aad46 Chore/deprecate old sql editor nav (#29584)
* Deprecate use of sqlFolderOrganizationFlag

* Deprecate SQLEditorNavV1

* Deprecate use of useSqlEditorStateSnapshot

* Deprecate old sql-editor valtio state
2024-10-01 13:34:14 +08:00
Terry SuttonandJoshen Lim 7d5c62c518 Chore/update without where warning (#28458)
* Add warning when running update without where

* Account for quotes

* Split warnings to allow them to show independently

* Update

* Combine two modals into one

* Padding bump

* Fix padding

* Return if a query has issues

* Allow queries to run

* Small UI tweaks

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-09-20 17:33:47 +08:00
Joshen Lim 17e0c5dbcf Improve snippet organization in SQL Editor (#27881)
* Init changes for sql fodlers

* Added upsert logic in sql-editor-v2 valtio, hooked up with templates and quickstarts

* Do up logic for creating new snippets by typing in /new or by clicking new query button

* Do up logic for updating and deleting snippets

* Do up logic for favourites and shared snippets

* Do up logic for favourites and shared snippets

* Fix

* Fix saving indicator, add empty states for favorites and shared snippets

* Implement sorting

* Some minor QOL improvements

* Minor fix on empty state for private snippets

* Add delete folder mutation

* Implement create and update folder

* Fix reinstate with AI renaming for new snippets under folder

* Support controlled multi select behaviour in private snippets

* Undo changes to tree-view-multi-select

* Support bulk deletes

* Support moving queries + rendering queries in folders

* Support deleting folders and creating a new folder when moving a query

* Fix bug where renaming query removes content

* Add initial loading state in sql editor nav + handle fallback if cannot retrieve content by id

* Fix some spelling

* Fix TS issue in sql folders mutation keys

* Fix toggling favorite

* Lint

* Revert fallback behaviour in ]id] for now

* Fix favorites and shared snippets not showing

* Fix moving currently opened snippet leads to loading

* Support bulk moving

* Improve multi select logic a little

* Nit lint

* Reinstate AI retitling for untitled snippets when running query

* Remove hardcode in useAFlag

* Support creating new snippet in a folder directly

* Fix sharing snippets that are within a folder

* Fix sharing snippets within a folder

* Fix favorite

* Add loading state when fetching folder contents

* Fix favoriting snippets in folders
2024-07-17 12:23:19 +08:00
Joshen Lim ae8dafd0a4 Chore/optimizations for table editor query (#27553)
* Optimize table editor select query when cutting off column values

* Fix auto limit logic to consider offset
2024-06-26 17:15:20 +08:00
Terry Sutton e225efec66 Chore/fix limit bug (#27540)
Match uppercase limit
2024-06-25 14:01:30 -02:30
Terry Sutton 45998fd31a Chore/fix limit in sql query (#27179)
* Dont append limit on fetch first queries

* Add some tests
2024-06-18 20:46:00 +08:00
Joshen Lim 9e45053d25 Chore/sql editor pagination of results (#26857)
* Add pagination to SQL editor for results longer than 100 rows

* Change pagination to automatically setting a limit

* Fix

* Address initial comments

* Compress SQL editor actions when ai assistant is open and screen is of a certain width

* Fix checking

* Add some fixes and tests

* Add a message if the query had an error and the limit was applied

* Rename to suffixWithLimit

* Small refactor and fix
2024-06-04 15:20:18 +07:00
Ivan Vasilov 6f5cabdc62 feat: Make the conversational AI in the SQL editor default (#23142)
* Remove feature preview for the conversational AI for SQL editor.

* Remove all code related to the previous implementation of editor ai.

* Update the snapshots for the ai commands.

* Remove unneeded code from the ai panel.

* Show the diff bar when debugging.

* Convert the updateEditor function into a callback.

* Simplify the debugging functionality by using react state instead of react context.

* Erase the AI disclaimer when formatting code as modification.

* Add a button to clear the chat history.
2024-05-14 15:40:42 +02:00
7548fd1850 feat: Conversational AI for the SQL Editor (#21388)
* Add a API endpoint for generating queries for the SQL editor.

* Merge all multiline props.

* Add a new component for diff actions.

* Copy components for the AI panel.

* Add useChat hook.

* Add a feature preview for the this feature. The preview is dependent on the feature flag.

* Reorder the nesting in the SQL editor to accomodate the AI assistant.

* Try to fit both AI assistants in the SQL editor, available via a feature preview.

* Refactor the SQL editor to make the diff work correctly in all cases.

* Minor fixes for the old AI feature.

* Fix the debug functionality to work with both assistants.

* Fix some copy-paste leftovers.

* Remove unneeded code.

* Make the icons softer.

* Fix the name of the panel component.

* Fix console.logs.

* Add overflow to the AI assistant.

* surface opt in config in ai settings button

* Skip diffing if editor is empty

* Add selected state when selecting a message to insert/replace code

* Add sample prompts

* Add SQL ai dislaimer when replacing code

* Light mode action bar nudges

* Add text for the feature preview.

* lang nudges

* Hide the command suggestions for now.

* Set the discussion url to undefined.

* Don't add the disclaimer twice.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Terry Sutton <saltcod@gmail.com>
2024-03-05 17:26:11 +01:00
Kevin Grüneberg 136728f6ab perf: reorganize a few imports to improve bundle size (#21743) 2024-03-05 12:49:58 +08:00
Kevin Grüneberg f9a55935f5 chore: use type imports for types/interfaces (#21738) 2024-03-04 20:48:22 +08:00
Kevin Grüneberg d12332ea5a chore: xmas cleanup (#19938) 2024-01-04 17:27:49 +01:00
+14 247c72fff2 SQL Editor: CLI commands to import snippet as migration/seed (#17341)
* feat(sql-editor): cli commands to import snippet as migration/seed

* fix(sql-editor): reword to download snippet

* chore(sql-editor): update wording

* Move to tabed ui, move download button to context menu

* Inline

* feat: add react native auth blog and quickstart. (#19006)

* feat: add react native auth blog and quickstart.

* Grammarly check

* Minor edits.

* Added og image.

* chore: add password sign in and gif.

---------

Co-authored-by: Ramiro Nuñez Dosio <ramiro@supabase.io>

* fix: duplicate eslint dependency (#19028)

* Update sveltekit.mdx (#18998)

Extended authorization section of docs to mention use of Sveltekit sequence helper function for protecting routes alongside defining Supabase session. Also provided new code.

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* fix: add hello world example to edge functions quickstart (#19030)

* Fix project card status not showing (#19034)

* Fix project card status not showing

* Fix tooltip project card styling

* chore: update cli reference doc (#18934)

* Add docs for updating the image versions (#18160)

see #17930

* chore: fix casing of "encryption at rest" (#19032)

* chore: update self-hosted image versions (#18935)

chore: update image versions for docker/docker-compose.yml

* (docs) Update arg name that resulted from adapters release (#19024)

update arg name that resulted from adapters release

* docs: Fix an example (@supabase/ssr package) for Next.js API Route (#19009)

Update creating-a-client.mdx

replace `appendHeader` with `setHeader` for the Next.js API route example.

* chore: cleanup studio dependencies (#19040)

* Fix code text color (#19042)

* make dark: selector work again

* fix reference docs code color

* feat: remove note about tus rollout (#19007)

it has been rolled out to all projects

* docs: update language in database-size.mdx code block (#19033)

Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>
Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>

* Docs: Adds a page for enums (#18590)

* Adds a page for enums

* Adds some details on deleting values

* Update apps/docs/pages/guides/database/postgres/enums.mdx

Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>

* Update apps/docs/pages/guides/database/postgres/enums.mdx

Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>

* Update apps/docs/pages/guides/database/postgres/enums.mdx

Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>

* Update apps/docs/pages/guides/database/postgres/enums.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* removes dangerous operation

---------

Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>
Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update hugging-face.mdx: fix example curl request (#17667)

The example request did not match the example edge function because there is used prompt and in the curl script was used query

* docs: fix syntax error in create role command (#17755)

* Update auth-sso-saml.mdx (#17856)

* docs: Update auth-google.mdx (#18119)

* fix: Bump up Realtime to 2.25.35 (#19048)

* Update llamaindex.ipynb doc_hash to hash (#18838)

* Update llamaindex.ipynb doc_hash to hash

Update `doc_hash` to `hash` since running this as-is provided an `AttributeError`. 

Here's what the Python build-in `vars` gives me (truncated):

```python
{'id_': 'd94b1287-b3ef-4aba-ac6b-7a4e353b0327',
 'embedding': None,
 'metadata': {},
 'excluded_embed_metadata_keys': [],
 'excluded_llm_metadata_keys': [],
 'relationships': {},
 'hash': '4c702b4df575421e1d1af4b1fd50511b226e0c9863dbfffeccb8b689b8448f35',...}
```

* fix: SimpleWebPageReader & StorageContext imports

* chore: revert python version change

---------

Co-authored-by: Greg Richardson <greg.nmr@gmail.com>

* fix: add reference docs back to search index (#19054)

Reference docs weren't being indexed properly because the specs weren't
getting checked out at build time.

* docs: add RN videos and discoverability improvements. (#18633)

* docs: add RN videos and discoverability improvements.

* Apply suggestions from code review

Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>

* chore: run prettier.

---------

Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>

* docs: add getting started guide for Swift (#19044)

* docs: getting started guide for Swift

* Apply suggestions from code review

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Add new tutorial to menu

* Add correct image for tutorial

* style: format with-swift tutorial

* docs: add example to the repository

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com>

* docs: Update mentions of `foreign table` to `referenced table` (#18656)

* replace foreignTable parameter with referencedTable parameter

* remove redirects

* rename any mentions of foreign table to referenced table

* fix one mention of foreign table

* update some links

* guide: add pgroonga videos to pgroonga guide (#19073)

add pgroonga videos to pgroonga guide

* docs(swift): rename `authStateChanges` and remove `File` from upload method (#19067)

docs: fix authStateChanges and upload documentation

* Small style fixes

* Style

* Update

* Update

* Update UI components positioning for DownloadSnippetModal

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>
Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com>
Co-authored-by: Ramiro Nuñez Dosio <ramiro@supabase.io>
Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>
Co-authored-by: uncapped1599 <126204291+uncapped1599@users.noreply.github.com>
Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
Co-authored-by: Lakshan Perera <lakshan@supabase.io>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>
Co-authored-by: Div Arora <darora@users.noreply.github.com>
Co-authored-by: Oliver Rice <github@oliverrice.com>
Co-authored-by: Taishi <taishi.k0903@gmail.com>
Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
Co-authored-by: Inian <inian1234@gmail.com>
Co-authored-by: Joseph Yu <39754176+joseph082@users.noreply.github.com>
Co-authored-by: Maidi <mareike.haug@web.de>
Co-authored-by: Shinya Fujino <shf0811@gmail.com>
Co-authored-by: Andrei Soroker <soroker@gmail.com>
Co-authored-by: Isaac Abotsi <abotsi@users.noreply.github.com>
Co-authored-by: Filipe Cabaço <filipe@supabase.io>
Co-authored-by: Jason R. Stevens, CFA <jason@thinkjrs.dev>
Co-authored-by: Guilherme Souza <grsouza@pm.me>
Co-authored-by: Tyler <18113850+dshukertjr@users.noreply.github.com>
2023-11-21 20:32:07 +08:00
Ivan Vasilov 436bdb10ae chore: Move the studio app to apps/studio (#18915)
* Move all studio files from /studio to /apps/studio.

* Move studio specific prettier ignores.

* Fix the ui references from studio.

* Fix the css imports.

* Fix all package.json issues.

* Fix the prettier setup for the studio app.

* Add .turbo folder to prettierignore.

* Fix the github workflows.
2023-11-15 12:38:55 +01:00