Commit Graph
81 Commits
Author SHA1 Message Date
Joshen Lim fc7fb50aa2 Organize pg meta queries for studio (#43562)
## Context

We reached to a consensus that we'll keep manually written queries
within the `pg-meta` package

I'll shift queries over in several PRs but wanted to double check if the
changes here is a good folder structure

## Changes involved

- Am organizing dashboard queries in `pg-meta` based on product
  - So folder structure will be `/sql/studio/[product]/*.ts`
- Every constant will be exported directly from `pg-meta`'s index
- So consumption in dashboard will just be `import { xxx } from
'@supabase/pg-meta`

cc @avallete and @soedirgo on this one - lemme know if this is alright,
or if there's a preferred way to do this
2026-03-10 09:34:11 +07:00
Ivan Vasilov 1cd1ebfc7f chire: Sort imports in all packages, cms, design-system and ui-library apps (#41610)
Sorted all imports in all packages, `cms`, `design-system` and
`ui-library` apps by running `pnpm format` on them.

All changes in this PR are done by the script.
2026-02-05 13:54:10 +01:00
fadymak 021af022ca chore: use utils for query escaping (#41581) 2026-01-27 15:44:42 +01:00
issuedat 115ca3a2e3 feat(auth): improved user search (#41199)
* feat(auth): improved user search

* chore: fix types for columns

* feat: cursor-based pagination

* chore: remove trigram indexes in favour of b-tree
2025-12-24 12:24:43 +01:00
0e2c31bf60 feat: Stripe Sync Engine integration (#41317)
* add initial installation flow of stripe sync engine

* update docs link

* Add supabase_vault extension dep

* Add stripe logo to sync engine integration

* Move overview content to bottom of integration pages

* Add sync state to stripe sync page

* only check sync state if stripe integration is installed

* Use proper stripe-sync package and setup flows

* Improve sync engine installation ux

* Remove unused hardcoded dep

* Add alpha status to stripe sync engine integration

* fix typo

* run format

* fix types

* Rename the stripe-sync path to remove the 'integration". The path needs to have BASE_PATH to work on prod.

* Design tidy up (#41337)

UI tidy up

* update to latest sync engine package

* Add stripe key verification

* Remove noop try/catch

* Add integration isntallation telelemtry

* Add basic settings page

* Address coderabbit comments

* remove unused dep

* Remove state setting on render

* s/description/comment

* Cleanup settings screen UI

* Improve settings screen design

* update schema test snapshot

* Use latest stripe-sync-engine package

* Update repo url to new official location

* revert marketing change

* Update stripe sync engine package

* Add link to table from overview page

* Add feature flag and improve telemetry

* Fix missing useMemo dep

* add uninstall telemetry note

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com>
2025-12-20 00:42:10 +00:00
Andrew Valleteau 3221a38596 fix(pgmeta): table editor fails with reserved keyword column names (#41226)
* fix(pg-format): update reserved words list

* test: add more test

* fix: tests
2025-12-10 11:32:57 +01:00
8e705ecdbc fix(export all rows): use cursor pagination if possible (#40536)
Exporting all rows (in CSV, SQL, or JSON format) currently uses offset pagination, which can cause performance problems if the table is large. There is also a correctness problem if the table is being actively updated as the export happens, because the relative row offsets could shift between queries.

Now that composite filters are available in postgres-meta, we can change to using cursor pagination on the primary key (or any non-null unique keys) wherever possible. Where this is not possible, the user will be shown a confirmation dialog explaining the possible performance impact.

---------

Co-authored-by: Ali Waseem <waseema393@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-08 13:39:10 -05:00
issuedat cb25d2383a feat(auth): allow opting in to creating indexes on auth.users (#40955)
* feat(auth): allow opting in to creating indexes on `auth.users`

* chore: organize imports. use alert above table.

* chore: use default type to avoid 2 primary actions
2025-12-08 10:42:18 +01:00
Charis 50a0408e60 fix(table editor): prevent unnecessary update requests (#40192)
Continues on from a0afa9e, reducing the number of unnecessary requests made when table changes are saved.

Currently, when you open the "Edit table" side panel, make zero changes, and click "Save", an unnecessary request runs to:

- Alter the table's comment to its existing comment
- Alter the table's schema to its existing schema
- Alter the table's RLS enable status to its existing RLS enable status

This PR changes the payload so we only alter what has actually changed. It also adds some refactoring to define clearer types and add type safety for the three possible kinds of table save actions (create new, duplicate, update existing).

After this, there are still a few unnecessary column update actions happening on array columns; those will be fixed in a final PR.
2025-11-11 14:54:43 +00:00
Charis df63ce3658 fix(mssql foreign tables): disallow sort on columns filtered for equality (#40137)
There is an edge case interaction between the Postgres query parser and
MSSQL foreign tables, where the query parser may drop sort clauses that
are redundant with applied filters. This leads to invalid MSSQL syntax,
because the resulting query has a `limit` but no `sort`, and the user
sees a confusing error message.

This PR detects this edge case on MSSQL foreign tables. There are three
cases:
1. The user filters by a column, but there are still other columns
available for sorting. The default search for a sorting column will
leave out the filtered column.
2. The user filters by a column/several columns, and there are no more
columns that can be used for sorting. We stop the query and show an
admonition.
3. The user filters by a column, then tries to sort by the same column.
We stop the query and show an admonition.
2025-11-06 13:14:30 -05:00
7682bac0f3 Fix: Updated to use optimized search columns when getting user counts (#40107)
* Updated to use optimized search columns when getting user counts

* added unit tests for query builders

* minor

* Nit fix keywords URL param not getting loaded into search input field

* removed user footer

* updated tests for upstream

* updated integration tests

* updated tests to be int for paginated

* updated schema

* updated types

* updated type imports

* updated type imports

* Apply suggestion from @avallete

Co-authored-by: Andrew Valleteau <avallete@users.noreply.github.com>

* updated literal import

* refactor: use common escaping (#40186)

refactor: use utils for sql escaping

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Andrew Valleteau <avallete@users.noreply.github.com>
2025-11-06 15:32:34 +08:00
Ali Waseem 62a6ffcf0f Fix: Fixed string range to account for Z search (#40053)
* Fixed string range to account for Z search

* added statement for z
2025-11-04 07:26:50 -07:00
Ivan Vasilov e8d2738acf chore: Bump vulnerable dependencies (#39909)
* Bump @playwright/test to fix a playwright vuln.

* Deduplicate msw.

* Deduplicate yaml.

* Deduplicate tsx.

* Add vitest to the catalog and bump it.

* Deduplicate vitest extra packages.

* Bump and deduplicate vite to v7.

* Bump prismjs.
2025-10-29 18:07:32 +01:00
Tyler 036b32c77c guide: Update Postgres full text search docs with more content (#39760)
* update full text search docs with more content

* run formatter
2025-10-22 13:19:14 +02:00
CharisandJoshen Lim 9c4919948a fix(policy editor): reduce number of table role access queries (#39601)
* fix(policy editor): reduce number of table role access queries

On the Policies page, every single PolicyTableRow fires off its own
table roles access query (because each query is keyed to an individual
table). For users with many tables (400+), this causes the API to
rate-limit the dashboard.

Changed so that the table roles access query now fetches information for
the entire schema in one go, then organizes it by table.

* Nit refactors

* refactor: return minimal data from table access query

All we need to know is whether a given table has anon or authenticated
access, so just query for the list of tables that match that criteria
from information_schema.role_table_grants.

* refactor(policies page): more efficient sql query for getting anon/auth access tables

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-22 14:39:42 +08:00
Joshen Lim 0ea4f24bb5 Chore/persist auth users search configuration (#39649)
* Perist auth users search configuration

* nit

* Clean up

* Swap more params to use URL state

* Clean up
2025-10-20 12:52:51 +08:00
Charis 67c6ef6745 feat(pgmeta): filter by composite values (#39179)
* feat(pgmeta): filter by composite values

Current behavior:

Only single columns can be used as filters: `where version = 2`

New behavior:

Composite values can be used as filters: `where (id, version) = (1, 2)`

Motivation:

In order to correct an existing bug when fetching table rows, we need to
use cursor pagination on the primary key, but in order to handle
composite primary keys, we need to be able to filter by composite
values.

* refactor(pgmeta): allowlist in-tuple operators
2025-10-16 08:28:27 -04:00
Stojan DimitrovskiandJoshen Lim 0a3f4184a7 feat: optimized users page (#39349)
* feat: optimized users page

* Update UI

* Reinstate footer with count if mode is freeform

* Simplify disabled sort in performance mode

* Clean

* Small fix

* Final fixes

* Shift users SQL query to packages/pg-meta

* Nit unrelated: Clear query params from useLogsUrlState when going to logs tab of a selected user

* Shift user count SQL and get count estimate SQL into packages/pg-meta

* Fix

* Nit

* Nit

* Minor nits

* Refactor UX for searching

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-14 15:02:00 +08:00
Charis 5dbc8d44c0 fix(pgmeta): return pks in order (#39414)
Composite primary keys should be returned in order so we can be sure we
are using the index for efficient querying.
2025-10-10 10:58:52 -04:00
Joshen Lim f370cc6045 Fix query builder wrap table schema name in double quotes (#39067)
* Fix query builder wrap table schema name in double quotes

* Patch

* PATCH

* Fix

* Remove console log

* Clean up

* Simplify
2025-09-30 11:42:50 +08:00
Joshen Lim cf2a372fa5 Fix default order by columsn to exclude json columns (#39028) 2025-09-30 11:16:36 +08:00
Riccardo Busetti e12984c60f feat(replication): Add dialog to clarify replication requirements and limitations (#39032) 2025-09-29 12:09:26 +02:00
Ivan VasilovandRaúl Barroso 051d31ef07 chore: Bump Typescript to 5.9 (#38945)
* Move typescript version definition to pnpm-workspace.

* Bump typescript to 5.9.

* Minor fixes to satisfy the compiler.

---------

Co-authored-by: Raúl Barroso <code@raulb.dev>
2025-09-23 16:50:54 +02:00
Joshen Lim 664696eeab Chore/attempt to address ts build issue (#38846)
* Attempt to address Type instantiation is excessively deep and possibly infinite build error

* Attempt to address Type instantiation is excessively deep and possibly infinite build issue

* Nit
2025-09-22 11:27:25 +07:00
d52e2c252b Update AI SDK 5 (#37656)
* attempt to update packages and useChat

* update endpoints

* update zod

* zod

* update to v5

* message update

* Revert "zod"

This reverts commit ec39bac6b6.

* revert zod

* zod i

* fix complete endpoints

* remove async

* change to content

* type cleanup

* Revert the package bumps to rebuild them.

* Bump zod to 2.25.76 in all packages.

* Bump openai in all packages.

* Bump ai and ai-related packages.

* Remove unneeded files.

* Fix the rest of the migration stuff.

* Prettier fixes.

* zod

* v4 again

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-08-08 14:15:39 +07:00
Joshen LimandJordi Enric 011f6c3e87 Fix Table Editor not identifying truncated array column values properly (#37683)
* Fix Table Editor not identifying truncated array column values properly

* Add comment

* update tests

* Fix TS issues and shift test file to beside the file its testing

* Fix tests

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2025-08-06 11:11:14 +07:00
Bobbie Soedirgo f6419a49f4 fix(pg-meta): update reserved words (#37693) 2025-08-05 11:52:56 -02:30
Joshen Lim b80e798ecd Table editor cast column type to text if filtering with like based filter (#37341)
* Table editor cast column type to text if filtering with like based filter

* Update pg-meta tests

* Fix test cases for ~~ in advanced-query.test

* Fix tests in table-row-query.test
2025-07-22 16:32:46 +08:00
Joshen LimandAlaister Young e70242f822 Chore/clean up assistant mcp feature flags (#36772)
* Clean up usage of newOrgAiOptIn and useBedrockAssistant feature flags

* Remove all OpenAI endpoints

* Fix for self-hosted

* Default isLimited to false

* Update PG meta tests

* Fix unit tests for model

* Revert pg meta tests

* Fix test

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
2025-07-22 16:05:16 +08:00
Andrew Valleteau 4bd28eecb8 fix(api): set x-pg-application-name for dashboard (#37048)
chore(api): set x-pg-application-name for dashboard
2025-07-21 10:39:46 +02:00
Ivan Vasilov 64d3d1fb7f chore: Bump vulnerable dependencies (#36272)
* Bump vite version.

* Rename and bump the vercel/flags dependency.

* Bump all versions of esbuild to one.

* Bump image-size.

* Bump fastify.

* Bump prismjs.
2025-06-11 10:24:40 +02:00
Andrew ValleteauandJoshen Lim 2d0b321ec6 fix(table-editor): handle multi-dimentional array truncation and preview (#36108)
* fix(table-editor): handle multi-dimentional array truncation and preview

* fix(SidePanelEditor): fully load truncated input fields

* Small tweaks

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-06-05 10:52:47 +08:00
Andrew Valleteau 521979748b fix(studio): use null last order by default (#35794)
* fix(studio): use null last order by default

* chore(tests): update tests
2025-05-21 10:26:40 +02:00
Julien Goux b7057fa9d8 fix: move triggers requests to query route (#35667) 2025-05-20 15:41:43 +08:00
b09440bd47 fix: move table create update delete to query route (#35662)
* fix: move table create update delete to query route

* chore: implement query to fetch a single table

* fix: retrieve table after update

* chore: assign type to update table payload

* chore: use updated table columns for edit

* chore: make executeSql castable with generic (#35685)

* Chore/refactor derivate more types from queries (#35687)

* chore: make executeSql castable with generic

* chore: derivate types from performed queries

- It allows to decouple more the frontend logic and the pg-meta/sql-query logic allowing to reduce the number of cast
and get closer types between what we do fetch and what we expect in our components

* fix: remove existing check

* chore: handle null comment and check

* fix: format check name as identifier

---------

Co-authored-by: avallete <andrew.valleteau@supabase.io>
Co-authored-by: Andrew Valleteau <avallete@users.noreply.github.com>
2025-05-20 10:34:59 +08:00
Han Qiao dc2f1270db fix: move column delete and update to query route (#35497)
* fix: move column create request to query route

* chore: replace table id with fully qualified name

* chore: consolidate default column value tests

* chore: consolidate array column tests

* chore: test setting default value to null

* fix: move column delete and update to query route

* chore: remove unused code
2025-05-15 11:42:29 +08:00
Han QiaoandAndrew Valleteau 80791c01b5 fix: move column create request to query route (#35532)
* fix: move column create request to query route

* chore: replace table id with fully qualified name

* chore: consolidate default column value tests

* chore: consolidate array column tests

* chore: test setting default value to null

* chore: remove unused code

---------

Co-authored-by: Andrew Valleteau <avallete@users.noreply.github.com>
2025-05-14 13:23:31 +08:00
Han Qiao 5601bb3e9c fix: move publication create and update to query route (#35633)
* fix: move publication create and update to query route

* fix: update mutation should use query route
2025-05-14 12:54:58 +08:00
Andrew Valleteau a90d29aef7 chore(docs): fix comment misspell (#35638)
chore: fix comment misspell
2025-05-13 09:39:09 -04:00
Han Qiao ca06acef00 fix: move extension requests to query route (#35583)
* fix: move extension requests to query route

* chore: escape schema name as identifier
2025-05-13 00:31:18 +08:00
Han Qiao e2fddfeeeb fix: move policy requests to query route (#35500) 2025-05-12 23:54:46 +08:00
Andrew Valleteau 71b261932e chore(refacto): throw error instances (#35617)
* chore: throw error instance for pgMetaGuard

* chore: throw error instance for Query utils

* chore: attempt to fix flawkyness
2025-05-12 10:53:15 +02:00
hallidayoandCharis Lam fbc48bf8f2 docs: ionic vue update (#35103)
* initial app without storage

* code tab typo

* format

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2025-04-17 22:53:28 +00:00
Andrew Valleteau c0bddbba9a fix(table-editor): use CTE optimization for table-editor selection (#35071)
* fix(table-editor): use CTE optimization for table-editor selection

* chore: add comments
2025-04-17 12:47:16 +08:00
Ivan Vasilov 326c7535f6 chore: Bump vulnerable deps. (#34395)
* Bump all testing libs to force babel to upgrade itself.

* Remove react-hooks package, it's included in @testing-library/react.

* Add await to all useEvent calls.

* Remove duplicate babel/helpers.

* Deduplicate babel/core.

* Bump vite to non-vuln version.

* Bump estree-util-value-to-estree.
2025-04-16 10:02:06 +02:00
Ivan Vasilov 6d077a3e28 chore: Bump vite and vitest (#34664)
* Set overrides for vite/esbuild packages, they're not used in production, low risk of something breaking.

* Bump vitest.

* Remove lodash.template from design-system.

* Forgot to run pnpm.
2025-04-03 12:43:28 +02:00
Joshen Lim 06091157d9 Table editor filter convert empty string value to null if column is not text based type (#34674) 2025-04-03 15:46:29 +08:00
Andrew Valleteau e36f1715b3 fix(studio): keep json formatting when truncating arrays (#34546) 2025-04-03 09:01:49 +02:00
dependabot[bot]andIvan Vasilov 6dce651a94 chore(deps-dev): bump vite from 6.2.1 to 6.2.4 (#34590)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.2.1 to 6.2.4.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v6.2.4/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.2.4/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-04-02 08:45:30 +00:00
Kevin Grüneberg 56e2096f2f chore: cleanup deps (#34433) 2025-03-26 13:38:02 +01:00