Commit Graph

42 Commits

Author SHA1 Message Date
Charis 116faefcda studio: convert more executeSql callers to SafeSqlFragment (#45645)
## Summary

- Converts ~27 `executeSql` call sites in `apps/studio/data/**` to build
SQL through `safeSql` / `ident` / `literal` / `keyword` /
`joinSqlFragments` instead of raw template-string interpolation.
- Tightens the `useDatabaseCronJobCreateMutation` and
`useDatabaseEventTriggerCreateMutation` `sql`/`query` parameter types
from `string` to `SafeSqlFragment` (callers already produce one).
- Updates `getDeleteEnumeratedTypeSQL` in `packages/pg-meta` to return
`SafeSqlFragment`.
- Fixes a bug noticed while testing where Queues integration does not
correctly handle queues with uppercase names.

## Pages to manually test

- Integrations > Cron Jobs
- Integrations > Queues
- Database > Triggers > Event Triggers
- Database > Indexes
- Reports > Query Performance
- Storage

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Bug Fixes**
  * Queue lookups now correctly handle case-insensitive queue names.
* Queue table references are now properly managed and consistently
applied throughout the queue management interface.
  * Improved queue name display normalization in the user interface.

* **Chores**
* Enhanced SQL query safety across the database layer through
parameterized query construction and safer templating approaches.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-06 12:21:48 -04:00
Alaister Young d272c15d8d [FE-2792] feat(studio): unify table exposure check on RLS policies page (#45041)
Fixes the RLS policies page showing self-contradictory or wrong
admonitions for tables with partial grants. Classifies each table using
the same `granted / custom / revoked` semantics used by the Data API
settings page so the two views agree on what counts as "exposed".

**Changed:**
- `PolicyTableRow` now uses `useTableApiAccessQuery` (shared cache with
the Table Editor sidebar) instead of a bespoke
`tables-roles-access-query`
- Boolean soup collapsed into a single `TableDataApiStatus`
discriminated union (`schema-not-exposed | no-grants | custom-grants |
publicly-readable | locked-by-rls | secured`) via a pure helper
- Admonition copy for `no-grants` and `locked-by-rls` updated; a table
with no policies but full grants now reads "No data will be returned via
the Data API as no RLS policies exist on this table." instead of the
earlier self-contradictory "can be accessed but no data will be
returned"
- `table-api-access-query.ts` now exposes a `grantStatus: 'granted' |
'custom'` on `access` entries — `granted` = all 3 API roles × all 4 CRUD
privileges (matches `getTableGrantsCTEs` in pg-meta)

**Added:**
- New `custom-grants` admonition: "This table has custom Data API
permissions — access may be restricted for some roles or operations."
- Unit tests for `getTableDataApiStatus`, `getTableAdmonitionMessage`,
and `isFullyGranted`

**Removed:**
- `data/tables/tables-roles-access-query.ts` and the `rolesAccess` key —
no more callers

## To test

On a project with the `public` schema exposed, for each scenario check
the admonition shown on `/project/{ref}/auth/policies`:

1. Table with full standard grants, RLS on, no policies → "No data will
be returned via the Data API as no RLS policies exist on this table."
2. Table with full standard grants, RLS off → yellow warning "can be
accessed by anyone"
3. Table with partial grants (e.g. only `GRANT SELECT ON t TO anon`) →
new "custom Data API permissions" admonition regardless of RLS state
4. Table with no anon/authenticated/service_role grants → "cannot be
accessed via the Data API"
5. Schema not in the exposed list → "schema not exposed" admonition with
link

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Tests**
* Added unit tests covering table Data API/RLS status classification and
API grant validation.

* **Refactor**
* Introduced a unified per-table API/RLS status model and reusable
utilities to derive display status and admonitions.
* Simplified UI logic to drive access indicators and warnings from the
new status.

* **Chores**
  * Removed legacy role-based access query and its related keying logic.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-04-20 22:35:51 +08:00
Charis 205cbe7d26 chore(studio}: enforce import order, remove bare import specifiers (#44585) 2026-04-07 20:34:10 -04:00
Aaron Byrne 205dac33da feat: Adding a more lightweight query to pg-meta that just fetches the table names (#44469)
Bug fix & feature

## What is the current behavior?

Customers with large schemas have trouble running:
pg-meta/{ref}/tables?include_columns=false

## What is the new behavior?

In the webhooks view some users with large schemas could not click a
table name as the underlying query times out. This just adds a light
weight query and fetches the table name
## Additional context

Add any other context or screenshots.

## Summary by CodeRabbit

* **Refactor**
* Optimized table name fetching in the database interface by introducing
an enhanced query mechanism that streams table metadata more efficiently
from the database.
2026-04-06 09:57:08 -04:00
Charis 3b7052b5a9 cleanup: fix import order and prefixes for studio/data (#44501) 2026-04-03 09:15:57 +02:00
Joshen Lim be26feb9ba Chore/shift manual queries into pg meta 03 (#43951)
## Context

Shifting more dashboard queries into pg-meta so that we centralize all
manually written queries in one place
Having them in packages/pg-meta also allows us to write tests for them

## To test

Just needs a smoke test on
- Table Editor
  - Fetching entities
  - Viewing definition 
- SQL Editor
  - View ongoing queries
  - Abort queries
- Integrations
  - Queues
- Database
  - Migrations
  -Triggers (Updating)
2026-03-19 18:31:46 +08:00
Vaibhav f53b8f4dd7 fix: remove connectionString check (#43091)
## Problem
In local/self-hosted mode, tables incorrectly show "API disabled" even
when they have valid RLS policies.

This happens because:
1. `project.connectionString` is `null` for local/self-hosted (defaults
to null per API types)
2. `useTablesRolesAccessQuery` has `!!connectionString` in its enabled
condition
3. The query never runs, so the UI can't determine actual API access
status


## Solution
Removed `!!connectionString` check from `useTablesRolesAccessQuery`'s
enabled condition.

This is safe cause:
- likewise `executeSql` already handles null/empty connectionString via
`connectionString ?? ''`
For local/self-hosted, the query works without connectionString (pg-meta
uses direct database connection)
The query now runs and correctly works

Before:
<img width="1577" alt="Before fix - API disabled shown incorrectly"
src="https://github.com/user-attachments/assets/0510fe38-a4ff-4898-aacb-b2ec8f1a2182"
/>

After:
<img width="1128" alt="After fix - API status displays correctly"
src="https://github.com/user-attachments/assets/5784b76b-f7e7-4281-ac40-57408a17a294"
/>

- Closes #43081

Co-authored-by: Andrey A. <56412611+aantti@users.noreply.github.com>
2026-03-12 14:08:52 -06:00
Gildas Garcia f66eb3f7bd feat: Allow to edit a column from the schema visualiser (#43592)
## Problem

Editing a column from the schema visualiser requires many clicks

## Solution

When hovering over a column in the schema visualiser, an edit button
should appear on the right side. Clicking this button should open the
column edit pane on the right side of the screen. This would reduce the
number of clicks required and allow users to make edits directly from
the visualiser instead of using it only as a visual aid.
2026-03-10 19:28:38 +01:00
Charis 1d49e9e954 feat(studio): show icon on tables exposed by data api (#41416)
* feat(studio): show icon on tables exposed by data api

Show an icon in the Table Editor for tables that are exposed via the
Data API.

* refactor(studio): move table api access query up to parent

* fix(studio): invalidate table privileges query on table create

* fix(studio): make RLS disabled warning on table editor more obvious

Change from warning -> danger

* Only show add foreign key in side panel if isSuccess

* chore(studio): put data api exposed badge behind feature flag

Only show badge for now if flag `dataApiExposedBadge` is enabled.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-18 16:50:26 +00:00
Ivan Vasilov 0d5be306ef chore: Bump React Query to v5 (#40174)
* Bump the deps, refactor deprecated code.

* Migrate keepPreviousData usage.

* Migrate all uses of InfiniteQuery.

* Fix refetchInterval in queries.

* Migrate all use of isLoading to isPending in mutations.

* Fix accessing location in claim-project.

* Fix a bug in duplicate query keys.

* Migrate all queries to use isPending.

* Revert "Fix accessing location in claim-project."

This reverts commit 2a07df64b5.

* Revert the rss.xml file to master.
2025-12-10 10:10:29 +01:00
Saxon Fletcher 9d66964b62 table create performance (#40857)
* table create performance

* test

* Clean up + refactor

* Nit housekeeping

* Minor housekeeping again

* Fix

* Fixy

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-11-27 20:27:19 +08: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
Ivan Vasilov 8b657165b5 chore: Migrate to use custom type for ReactQuery queries and mutations (#40073)
* Add custom types for queries, mutations and infinite queries.

* Migrate all queries to use the new type.

* Migrate all infinite queries to useCustomInfiniteQueryOptions.

* Migrate all mutations to use useCustomMutationOptions.

* Add type to all imports in `types` folder.
2025-11-03 13:18:13 +01:00
Ivan Vasilov da4a40e308 chore: Migrate RQ functions to use object syntax style (#39895)
* Migrate all uses of invalidateQueries to use object syntax.

* Migrate the remainder of useInfiniteQuery.

* Migrate all setQueriesData.

* Migrate all fetchQuery uses.

* Migrate some leftover functions from RQ.

* Fix issues found by Charis.
2025-10-28 10:43:14 +01:00
Stojan Dimitrovski 1af6b84790 types are broken (#39866)
* types are broken

* Fix TS issues

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-28 10:38:07 +08:00
Alaister Young 8855d05803 chore(studio): swap react-query to object syntax (#39842)
* chore(studio): swap react-query to object syntax

* Fix small issues found

* Fix realtime settings

* Nit

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-27 09:38:27 +01:00
Charis 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 a3e585b4ae Chore/refactor database publications page (#37901)
* Refactor database publications page

* Use new page layout

* Update apps/studio/components/interfaces/Database/Publications/PublicationsList.tsx

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

* Address feedback

* Add tooltips

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
2025-08-14 13:24:06 +07: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
Han Qiao 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
Joshen Lim 227bb54853 Improve auth policies RLS warnings granularity (#35579) 2025-05-14 18:02:07 +08:00
Andrew Valleteau 31aad403de fix(studio): early fail query when x-connection-encrypted is invalid (#35331)
* fix(studio): early fail query when x-connection-encrypted is invalid

* fix(studio): uniformize readDatabase and projectDetails connString handling

* chore: update api types

* chore: add connectionString null option

* fix: only enforce x-connection-encrypted on platform

* chore: refactor connString check in a single point

* chore: fix guard logic

* chore: fix pgMetaGuard

* chore: fix types
2025-05-08 12:11:03 +02:00
Jonathan Summers-Muir 143f49414b Feat/tabs (#31071)
* init

* Update inner-side-menu.mdx

* chore: update SQL sidebar to use ui pattern components

* mor

* Update

* Update index.tsx

* init: merge table editor and sql editor and schema visualization together

* more

* move to valtio

* fix issue with Command+B shortcut

* now shows in treeviews if item is opened in tab

* Update ProjectLayout.tsx

* fix sidebar

* fix schema selector for non explorer version

* show schema name in tabs

* added schema names to tabs

* tabs have been updated to support preview tabs

* fix URL issue

* add empty state stuff

* Update SQLEditorNav.tsx

* preview tab works now

* more tabs stuff. 'new' tab also added

* new tab concept

* updates

* fix type errors

* remove unused files

* update test

* move back button, fix width issues on sidebar

* update sidebar logic

* Update ProjectLayout.tsx

* lots of updates. layouts now streamlined. localstorage for tabs in use

* moar

* bunch of new tab logic

* fix empty tab issue

* Update tabs.ts

* layouts switched

* new pages now have fixed layouts

* fix tabs

* fix code bg

* add tabs support for multiple project refs

* intialization issue

* update ID handling

* fixed isOpened state for SQL snippets

* remove old assistant because its bugging up panels

* preview style works in sql editor

* fix border

* removes preview tab if there is one

* fix background of loading skeleton

* lots of issues with types/icons/redirect

* new tab cards

* snippets in empty state now work

* moar stuff

* tabs now in feature flags

* Update tabs.ts

* Update tabs.ts

* moar

* add feature previews

* remove code not needed

* Update next-env.d.ts

* Delete FeaturePreviewModal.tsx

* fix typescript errors. remove more explorer stuff

* remove explorer files

* fixed issues with templates and quickstarts tab

* fixed active state when tabs are not opted in

* logic error

* fix open/highlight issue when opted out of tabs

* templates/quickstarts now displayed with new cards

* Update recent-items.tsx

* Update new-tab.tsx

* add icon back in

* add old empty state back in

* recent items updated to respect project ref

* localstorage cleanup on deletion

* moar

* overflow tabs now working

* correct tab names used for new sql templates/quickstarts

* ongoing queries fix

* cleanup

* update images

* Update RouteValidationWrapper.tsx

* Update AppLayout.tsx

* Update NavigationBar.tsx

* add headers back into side panels

* improve writing

* tabs now drag and drop a billion times better

* Update tabs.tsx

* Update tabs.tsx

* init issues on stores, which caused a race condition.

* fix hydration error

* fix new tab issue in sql

* Update ProjectLayout.tsx

* Update pnpm-lock.yaml

* Update new-tab.tsx

* move EditorMenuListSkeleton

* Fix type issues

* fixes: DESIGN-87

fixes: DESIGN-87

* refactor sort/filter components

* Update rules-set-button-text.tsx

* remove discussions for now

* small styling fixes

* Update FeaturePreviewModal.tsx

* Update FeaturePreviewModal.tsx

* Update RouteValidationWrapper.tsx

* revert

* revert

* revert

* revert

* revert

* more revert

* Update collapse-button.tsx

* Update SQLEditorTreeViewItem.tsx

* revert

* Update SchemaGraph.tsx

* Delete new-upcoming.tsx

* revert

* Update ProjectLayout.tsx

* fix home link

* Update table-editor.spec.ts

* test update

* Update table-editor.spec.ts

* Fix the playwright tests.

* layout fixes

* layout fix

* revert sort/filter

* Update LastSignInWrapper.tsx

* revert

* revert

* remove

* update file names

* revert

* revert

* revert

* Fix TreeView console error props

* Add guards in SQL Editor to ensure that feature preview tabs changes do not affect existing UI when flag is off

* Fix missing DefaultLayout in SQL editor templates + fix New tab

* Remove console log

* Remove DatabaseSelector for SQL editor on local

* Fix SQL editor shared favorites for local

* Fix test

* Ensure NewTab doesn't show up if flag is not toggled for SQL editor

* Decouple UI state changes from content-query and entity-types-infinite-query

* Fix tab closing unnecessary rerouting

* Beef up feature previews

* Fix create new table from table editor new tab

* Fix tabs getting incorrectly reset when going between table and SQL editors

* Fix last visited SQL snippet for both tabs and not tabs

* Fix last visited table for table editor tabs

* Clear dashboard history when closing last tab

* Fix loading dashboard history

* Add comment to refactor stores

* Ensure we only save up to 8 items for recent items for each type

* Remove unneccesary logic in tabs

* Smol style fix for DeleteAccountButton

* Smol fix

* Fix inability to close New tab

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Alaister Young <a@alaisteryoung.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-03-27 17:46:57 +08:00
Joshen Lim 8d527f7f9e Update database-triggers react queries to use methods from data/fetchers (#33546)
* Update database-triggers-query to use get from data/fetchers

* Update database triggers mutation RQs to use methods from data/fetchers

* Don't cd to the directory, use the --dir parameter of pnpm.

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-02-12 16:04:35 +08:00
Alaister Young 6c592dec99 chore: remove useExecuteSqlQuery() part 2 (#30467)
* foreign-key-constraints

* update entity-types stale time

* schemas query

* deprecate useExecuteSqlQuery

* users count query

* database size query

* indexes query

* keywords query

* migrations query

* table columns

* database functions

* database roles query

* fdws query

* replication lag query

* ongoing queries query

* vault secrets query

* remove unneeded staleTime: 0

* max connections query

* fix entity types key in tests

* Some fixes

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-11-18 05:15:37 +00:00
Alaister Young a5a2873302 chore: table editor optimisation 2 (#30295)
* chore: table editor query optimisation 2

* fix editing tables from tables page

* Small style fixes

* Small style fixes

* address feedback

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-11-06 08:31:35 +00:00
Alaister Young 3a27070dc2 chore(perf): table editor query optimisation (#30184)
* chore: table editor query optimisation

* removed unused queries and fix invalidations

* address feedback

* fix filtering for foreign tables

* Update

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-10-31 15:20:40 +08:00
Alaister Young 5781937739 chore: aggressive prefetching (#29987)
* chore: aggressive prefetching

* use abort signals in prefetchers

* move encrypted columns to react-query

* prefetching for filter and sort applied

* prefetch remaining entity types

* prefetch tables in more places

* prefetch editor page on project panel

* add feature flag

* fix typescript

* nit

* Nit

* fix imports

* remove views check on encrypted schemas

* use fetchQuery instead of prefetchQuery

* fix useEncryptedColumnsQuery ts error

* filter by schema on encrypted columns

* don't use pg_get_tabledef for foreign tables

* Remove unnecesary import

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-10-24 20:59:35 +08:00
Charis ed73af27d4 feat: command to query a table (#28683) 2024-09-12 18:12:06 -04:00
Ivan Vasilov df52ea7ee0 feat: Replace all toasts with sonner (#28250)
* Update the design of the sonner toasts. Add the close button by default.

* Migrate studio and www apps to use the SonnerToaster.

* Migrate all toasts from studio.

* Migrate all leftover toasts in studio.

* Add a new toast component with progress. Use it in studio.

* Migrate the design-system app.

* Refactor the consent toast to use sonner.

* Switch docs to use the new sonner toasts.

* Remove toast examples from the design-system app.

* Remove all toast-related components and old code.

* Fix the progress bar in the toast progress component. Also make the bottom components vertically centered.

* Fix the width of the toast progress.

* Use text-foreground-lighter instead of muted for ToastProgress text

* Rename ToastProgress to SonnerProgress.

* Shorten the text in sonner progress.

* Use the correct classes for the close button. Add a const var for the default toast duration. Remove the custom width class from sonner.

* Set the position for all progress toasts to bottom right. Set the duration for all toasts to the default (when reusing a toast id from loading/progress toast, the duration is set to infinity).

* Fix the playwright tests.

* Refactor imports to use ui instead of @ui.

* Change all imports of react-hot-toast with sonner. These components were merged since the last commit to this branch.

* Remove react-hot-toast lib.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
2024-08-31 07:50:51 +08:00
Joshen Lim 54320ddb73 Chore/support showing all entities in database tables page (#27749)
* Support showing views in database tables page

* Support showing materialized views in database tables page

* Support showing foreign tables in database tables page

* Prevent deleting non table entities in database/tables, consistent with table editor

* Fix invalidation logic when deleting tables in database/tables
2024-07-03 14:40:45 +08:00
Terry Sutton aa90e578ca Chore/show unlock icon next to view entities (#23238)
* Show unlock icon next to views and foreign tables

* Temp header actions for all entities

* Add warnings for views and foreign tables

* Add labels for each entity type

* Cleanup

* Unneeded comma

* Remove unneeded useEffect

* Check lints on the entities menu too

* Pass exposed schemas to lint query

* Type cleanup

* Update

* Update lint, add 0016

* Fix materialized view logic

* Cleanup

* Grab lint count

* Update apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx

Co-authored-by: Inian <inian1234@gmail.com>

* Update apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx

Co-authored-by: Inian <inian1234@gmail.com>

* Update apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx

Co-authored-by: Inian <inian1234@gmail.com>

* Update apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx

Co-authored-by: Inian <inian1234@gmail.com>

* Language changes

* Use lints for gridheaderactions

* Types cleanup

---------

Co-authored-by: Inian <inian1234@gmail.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2024-05-23 16:52:03 -02:30
Joshen Lim 0d292c668d Contextual error toasts for deleting referenced rows (#23135)
* Contextual error toasts for deleting referenced rows

* Update message
2024-05-02 13:58:52 +08:00
Alaister Young 08a0a86c77 fix: table deletion invalidation (#22858) 2024-04-18 19:04:03 +10:00
Kevin Grüneberg f9a55935f5 chore: use type imports for types/interfaces (#21738) 2024-03-04 20:48:22 +08:00
Joshen Lim 7556a3181c Update error handling for table editor RQs (#21443) 2024-02-22 16:29:10 +08:00
Terry Sutton 46051bce17 Chore/table editor header simplification (#18366)
* start

* Update

* Types

* Passhref

* Cleanup

* Update

* Fix

* Updates

* Updates

* Enable RLS from table editor

* Cleanup

* Filter current table policies

* Fix missing footer

* Duplicate role picker

* Remove rls banner

* Add tooltip for rls enabled, but no policies

* Fix footer positioning

* Prettier

* Change wording

* Update button style

* Cleanup

* Small update

* Fix Auth policies button number bg color

* Fix

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-02-15 09:10:30 -03:30
Ivan Vasilov e81442de56 chore: Migrate TableStore (#20033)
* Add create, update and delete mutations for tables.

* Use the new mutations instead of the table store.

* Fully remove the TableStore from the MetaStore.

* Move the methods from MetaStore into pure functions in SidePanelEditor utils.

* Remove TableStore.

* Refactor the onError callbacks to be on the mutations.

* Convert some of the UIStore invocations.

* Fixed not closing the modal in case of an error. Migrate some uses of uiStore.

* Use onSettled on all RQ hooks.

* Remove the ui param to the create/updateTable functions.

* Add a missing connection string.

* Add progress bar for loading UI for importing rows

* Update apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
2024-02-06 14:56:59 +08:00
Alaister Young a4f86bce8f chore: increase react-query stale time (#19465)
* chore: increase react-query stale time

* keep staleTime: 0 for table rows

* use staleTime: 0 for all user sql queries

* use staleTime: 0 for all pg-meta queries

* Some fixes

* fix updating tables

* fix bug while editing column names

* Fix deleting column in database/tables column list not revalidating UI

* Fix updating column in database/tables column list throwing ane rror

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-02-06 13:47:05 +08:00
Ivan Vasilov b6d8e770fa fix: Don't fetch columns when fetching tables by default (#20157)
* Only fetch the tables from the required schema in the MetaStore.

* Don't include the columns in the getTables API call unless a flag is passed.

* Use the new flag in the ForeignKeySelector.

* Columns should be included for the schema visualizer.

* Address comments.
2024-01-09 17:39:40 +01:00
Terry Sutton c685d654b6 Feat/sortby on tables (#19841)
* Sort by name

* Not name

* Fix

* Migrate the table query to use the new fetchers.

* Cleanup

* Cleanup

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2023-12-21 15:53:38 -03:30
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