The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: remove tableQuickstart and realtimeButtonVariant experiments (#42388)
Pamela Chiab6d8f2ae2da1
diff --git a/apps/studio/.github/eslint-rule-baselines.json b/apps/studio/.github/eslint-rule-baselines.jsonindex d87d6856e73..aa7b0586482 100644--- a/apps/studio/.github/eslint-rule-baselines.json+++ b/apps/studio/.github/eslint-rule-baselines.json@@ -99,8 +99,6 @@"components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/index.tsx": 2,"components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx": 1,"components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/TextEditor.tsx": 2,- "components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/QuickstartAIWidget.tsx": 1,- "components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/useAITableGeneration.ts": 2,"components/interfaces/TableGridEditor/TableDefinition.tsx": 1,"components/interfaces/TableGridEditor/TableGridEditor.tsx": 2,"components/interfaces/UnifiedLogs/ServiceFlow/components/ServiceFlowHeader.tsx": 2,diff --git a/apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx b/apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsxindex 15aaa77e21e..4a201d8d802 100644--- a/apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx+++ b/apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx@@ -14,7 +14,6 @@ import { ButtonTooltip } from 'components/ui/ButtonTooltip'import { useDatabasePoliciesQuery } from 'data/database-policies/database-policies-query'import { useDatabasePublicationsQuery } from 'data/database-publications/database-publications-query'import { useDatabasePublicationUpdateMutation } from 'data/database-publications/database-publications-update-mutation'-import { useDatabaseTriggersQuery } from 'data/database-triggers/database-triggers-query'import { useProjectLintsQuery } from 'data/lint/lint-query'import {Entity,@@ -26,7 +25,6 @@ import {import { useTableUpdateMutation } from 'data/tables/table-update-mutation'import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'-import { RealtimeButtonVariant, useRealtimeExperiment } from 'hooks/misc/useRealtimeExperiment'import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'import { useIsProtectedSchema } from 'hooks/useProtectedSchemas'import { DOCS_URL } from 'lib/constants'@@ -112,11 +110,6 @@ export const GridHeaderActions = ({ table, isRefetching }: GridHeaderActionsPropconst realtimeEnabledTables = realtimePublication?.tables ?? []const isRealtimeEnabled = realtimeEnabledTables.some((t) => t.id === table?.id)- const { activeVariant: activeRealtimeVariant } = useRealtimeExperiment({- isTable,- isRealtimeEnabled,- })-const { mutate: updatePublications, isPending: isTogglingRealtime } =useDatabasePublicationUpdateMutation({onSuccess: () => {@@ -133,21 +126,6 @@ export const GridHeaderActions = ({ table, isRefetching }: GridHeaderActionsProp},})- const { data: triggersData } = useDatabaseTriggersQuery(- {- projectRef: project?.ref,- connectionString: project?.connectionString,- },- {- enabled: isTable,- }- )- const tableTriggers = (triggersData ?? []).filter(- (trigger) => trigger.schema === table.schema && trigger.table === table.name- )-- const tableTriggersCount = tableTriggers.length-const { can: canSqlWriteTables, isLoading: isLoadingPermissions } = useAsyncCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE,'tables'@@ -185,8 +163,6 @@ export const GridHeaderActions = ({ table, isRefetching }: GridHeaderActionsProptable.schema)- const manageTriggersHref = `/project/${ref}/database/triggers?schema=${table.schema}`-const toggleRealtime = async () => {if (!project || !realtimePublication) return@@ -369,54 +345,29 @@ export const GridHeaderActions = ({ table, isRefetching }: GridHeaderActionsProp</Popover_Shadcn_>)}- {isTable && activeRealtimeVariant === RealtimeButtonVariant.TRIGGERS ? (- <Button- asChild- type={'default'}+ {realtimeEnabled && (+ <ButtonTooltip+ type="default"size="tiny"icon={- <div- className={cn(- 'flex items-center justify-center rounded-full bg-border-stronger h-[16px]',- tableTriggersCount > 9 ? 'px-1' : 'w-[16px]'- )}- >- <span className="text-[11px] text-foreground font-mono text-center">- {tableTriggersCount}- </span>- </div>+ <MousePointer2+ strokeWidth={1.5}+ className={isRealtimeEnabled ? 'text-brand' : 'text-foreground-muted'}+ />}+ onClick={() => setShowEnableRealtime(true)}+ className={cn(isRealtimeEnabled && 'w-7 h-7 p-0 text-brand hover:text-brand-hover')}+ tooltip={{+ content: {+ side: 'bottom',+ text: isRealtimeEnabled+ ? 'Click to disable realtime for this table'+ : 'Click to enable realtime for this table',+ },+ }}>- <Link href={manageTriggersHref}>- {tableTriggersCount === 1 ? 'Trigger' : 'Triggers'}- </Link>- </Button>- ) : (- activeRealtimeVariant !== RealtimeButtonVariant.HIDE_BUTTON &&- realtimeEnabled && (- <ButtonTooltip- type="default"- size="tiny"- icon={- <MousePointer2- strokeWidth={1.5}- className={isRealtimeEnabled ? 'text-brand' : 'text-foreground-muted'}- />- }- onClick={() => setShowEnableRealtime(true)}- className={cn(isRealtimeEnabled && 'w-7 h-7 p-0 text-brand hover:text-brand-hover')}- tooltip={{- content: {- side: 'bottom',- text: isRealtimeEnabled- ? 'Click to disable realtime for this table'- : 'Click to enable realtime for this table',- },- }}- >- {!isRealtimeEnabled && 'Enable Realtime'}- </ButtonTooltip>- )+ {!isRealtimeEnabled && 'Enable Realtime'}+ </ButtonTooltip>)}{isView && viewHasLints && (diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsxindex ab128d6c7a4..23702640e35 100644--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx@@ -14,7 +14,6 @@ import { useEnumeratedTypesQuery } from 'data/enumerated-types/enumerated-types-import { useCustomContent } from 'hooks/custom-content/useCustomContent'import { useChanged } from 'hooks/misc/useChanged'import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'-import { RealtimeButtonVariant, useRealtimeExperiment } from 'hooks/misc/useRealtimeExperiment'import { useQuerySchemaState } from 'hooks/misc/useSchemaQueryState'import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'import { useTableCreateGeneratePolicies } from 'hooks/misc/useTableCreateGeneratePolicies'@@ -129,11 +128,6 @@ export const TableEditor = ({? false: realtimeEnabledTables.some((t) => t.id === table?.id)- const { activeVariant: activeRealtimeVariant } = useRealtimeExperiment({- isTable: !isNewRecord,- isRealtimeEnabled,- })-const { data: constraints } = useTableConstraintsQuery({projectRef: project?.ref,connectionString: project?.connectionString,@@ -456,7 +450,7 @@ export const TableEditor = ({</Admonition>)}- {activeRealtimeVariant !== RealtimeButtonVariant.HIDE_BUTTON && realtimeEnabled && (+ {realtimeEnabled && (<Checkboxid="enable-realtime"label="Enable Realtime"diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/QuickstartAIWidget.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/QuickstartAIWidget.tsxdeleted file mode 100644index d9c5ba1af34..00000000000--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/QuickstartAIWidget.tsx+++ /dev/null@@ -1,245 +0,0 @@-import { useCallback, useEffect, useRef, useState } from 'react'-import { toast } from 'sonner'-import {- AiIconAnimation,- Button,- Input_Shadcn_ as Input,- cn,- Tooltip,- TooltipContent,- TooltipTrigger,-} from 'ui'-import { Columns3, Table2 } from 'lucide-react'-import type { TableField } from '../TableEditor.types'-import { AI_QUICK_IDEAS } from './constants'-import type { TableSuggestion } from './types'-import { useAITableGeneration } from './useAITableGeneration'-import { convertTableSuggestionToTableField } from './utils'-import { useTrack } from 'lib/telemetry/track'--interface QuickstartAIWidgetProps {- onSelectTable: (tableData: Partial<TableField>) => void- disabled?: boolean-}--const SUCCESS_MESSAGE_DURATION_MS = 3000--export const QuickstartAIWidget = ({ onSelectTable, disabled }: QuickstartAIWidgetProps) => {- const [lastGeneratedPrompt, setLastGeneratedPrompt] = useState('')- const inputRef = useRef<HTMLInputElement>(null)- const track = useTrack()-- const {- generateTables,- isGenerating,- error: apiError,- prompt,- tables: storedTables,- setPrompt: setAiPrompt,- } = useAITableGeneration()-- const aiPrompt = prompt ?? ''- const tables = storedTables ?? []-- useEffect(() => {- if (inputRef.current) {- inputRef.current.focus()- }- }, [])-- useEffect(() => {- if (aiPrompt && tables.length > 0) {- setLastGeneratedPrompt(aiPrompt)- }- }, [])-- const handleSelectTemplate = useCallback(- (template: TableSuggestion) => {- track('table_quickstart_template_clicked', {- tableName: template.tableName,- columnCount: template.fields.length,- source: 'ai',- })-- const tableField = convertTableSuggestionToTableField(template)- onSelectTable(tableField)- toast.success(`Applied ${template.tableName} template. You can customize the fields below.`, {- duration: SUCCESS_MESSAGE_DURATION_MS,- })- },- [onSelectTable, track]- )-- const handleGenerateTables = useCallback(- async ({- promptOverride,- wasQuickIdea = false,- }: { promptOverride?: string; wasQuickIdea?: boolean } = {}) => {- const promptToUse = promptOverride ?? aiPrompt- if (!promptToUse.trim() || isGenerating) return-- track('table_quickstart_ai_prompt_submitted', {- promptLength: promptToUse.length,- wasQuickIdea,- })-- try {- const tables = await generateTables(promptToUse)-- track('table_quickstart_ai_generation_completed', {- success: tables.length > 0,- tablesGenerated: tables.length,- promptLength: promptToUse.length,- })-- setLastGeneratedPrompt(promptToUse)- } catch (error) {- track('table_quickstart_ai_generation_completed', {- success: false,- tablesGenerated: 0,- promptLength: promptToUse.length,- errorMessage: error instanceof Error ? error.message : 'Unknown error',- })- }- },- [aiPrompt, generateTables, isGenerating, track]- )-- const handleQuickIdea = useCallback(- (idea: string) => {- track('table_quickstart_quick_idea_clicked', {- ideaText: idea,- })-- setAiPrompt(idea)- handleGenerateTables({ promptOverride: idea, wasQuickIdea: true })- },- [handleGenerateTables, setAiPrompt, track]- )-- return (- <div className="rounded-lg border border-default bg-surface-100 p-6 transition-all hover:border-foreground-muted">- <div className="mb-4">- <div className="flex items-center gap-2 mb-2">- <AiIconAnimation size={16} loading={false} />- <h3 className="text-base font-medium">Generate tables with AI</h3>- </div>- <p className="text-sm text-foreground-lighter">- Describe your app and AI will create a complete table schema.- </p>- </div>-- <div className="space-y-3">- <div className="relative">- <Input- ref={inputRef}- placeholder="Describe your app (e.g., 'recipe sharing app')"- value={aiPrompt}- onChange={(e) => setAiPrompt(e.target.value)}- onKeyDown={(e) => {- if (e.key === 'Enter' && !e.shiftKey) {- e.preventDefault()- if (aiPrompt.trim()) {- handleGenerateTables()- }- }- }}- disabled={isGenerating || disabled}- aria-label="Table description for AI generation"- className="pr-24"- />- <Button- type="default"- size="tiny"- disabled={!aiPrompt.trim() || isGenerating || disabled}- onClick={() => handleGenerateTables()}- icon={<AiIconAnimation loading={isGenerating} />}- className="absolute right-1 top-1/2 -translate-y-1/2 !space-x-1"- >- {isGenerating- ? 'Generating...'- : aiPrompt === lastGeneratedPrompt && tables.length > 0- ? 'Regenerate'- : 'Generate'}- </Button>- </div>-- {apiError && (- <div className="text-sm text-red-600" role="alert">- {apiError}- </div>- )}-- {tables.length === 0 && (- <div>- <h4 className="text-xs text-foreground-light mb-2">Quick ideas:</h4>- <div className="flex flex-wrap gap-2">- {AI_QUICK_IDEAS.map((idea) => (- <button- key={idea}- onClick={() => handleQuickIdea(idea)}- disabled={isGenerating || disabled}- aria-label={`Generate table for ${idea}`}- className={cn(- 'flex items-center gap-1.5 px-2 py-1 rounded-md text-xs border border-default',- 'hover:border-foreground-muted hover:bg-surface-200',- 'disabled:opacity-50 disabled:cursor-not-allowed',- 'transition-all'- )}- >- <AiIconAnimation size={12} />- <span>{idea}</span>- </button>- ))}- </div>- </div>- )}-- {tables.length > 0 && (- <div className="grid gap-2">- {tables.map((template) => (- <button- key={`ai:${template.tableName}`}- onClick={() => handleSelectTemplate(template)}- disabled={disabled}- aria-label={`Select ${template.tableName} template with ${template.fields.length} fields`}- className={cn(- 'text-left p-3 rounded-md border transition-colors w-full bg-surface-100',- 'border-light hover:border-default hover:bg-surface-200 cursor-pointer',- 'disabled:opacity-50 disabled:cursor-not-allowed'- )}- >- <div className="flex items-start gap-3">- <div className="rounded-full bg-alternative border w-8 h-8 flex items-center justify-center flex-shrink-0">- <Table2 size={16} className="text-foreground" />- </div>- <div className="flex-1 min-w-0">- <div className="text-sm font-medium text-foreground mb-0">- {template.tableName}- </div>- {template.rationale && (- <div className="text-xs text-foreground-light mt-0.5">- {template.rationale}- </div>- )}- </div>- <Tooltip>- <TooltipTrigger asChild>- <div className="flex items-center gap-1 text-sm text-foreground-muted ml-3">- <Columns3 size={14} aria-hidden="true" />- <span>{template.fields.length}</span>- </div>- </TooltipTrigger>- <TooltipContent>- {template.fields.length} {template.fields.length === 1 ? 'column' : 'columns'}- </TooltipContent>- </Tooltip>- </div>- </button>- ))}- </div>- )}- </div>- </div>- )-}diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/QuickstartTemplatesWidget.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/QuickstartTemplatesWidget.tsxdeleted file mode 100644index 897a2f67f88..00000000000--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/QuickstartTemplatesWidget.tsx+++ /dev/null@@ -1,145 +0,0 @@-import { Columns3, Layers, Table2 } from 'lucide-react'-import { useCallback, useEffect, useState } from 'react'-import { toast } from 'sonner'--import { cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui'-import type { TableField } from '../TableEditor.types'-import { tableTemplates } from './templates'-import type { TableSuggestion } from './types'-import { convertTableSuggestionToTableField } from './utils'-import { useTrack } from 'lib/telemetry/track'--interface QuickstartTemplatesWidgetProps {- onSelectTemplate: (tableData: Partial<TableField>) => void- disabled?: boolean-}--const SUCCESS_MESSAGE_DURATION_MS = 3000-const CATEGORIES = Object.keys(tableTemplates)--export const QuickstartTemplatesWidget = ({- onSelectTemplate,- disabled,-}: QuickstartTemplatesWidgetProps) => {- const [activeCategory, setActiveCategory] = useState<string | null>(null)- const track = useTrack()-- useEffect(() => {- if (activeCategory === null && CATEGORIES.length > 0) {- setActiveCategory(CATEGORIES[0])- }- }, [activeCategory])-- const handleCategorySelect = useCallback(- (category: string) => {- setActiveCategory(category)- track('table_quickstart_category_clicked', {- categoryName: category,- })- },- [track]- )-- const handleSelectTemplate = useCallback(- (template: TableSuggestion) => {- track('table_quickstart_template_clicked', {- tableName: template.tableName,- columnCount: template.fields.length,- source: 'templates',- categoryName: activeCategory ?? 'Unknown',- })-- const tableField = convertTableSuggestionToTableField(template)- onSelectTemplate(tableField)- toast.success(`Applied ${template.tableName} template. You can customize the fields below.`, {- duration: SUCCESS_MESSAGE_DURATION_MS,- })- },- [onSelectTemplate, track, activeCategory]- )-- const displayedTemplates = activeCategory ? tableTemplates[activeCategory] || [] : []-- return (- <div className="rounded-lg border border-default bg-surface-100 p-6 transition-all hover:border-foreground-muted">- <div className="mb-4">- <div className="flex items-center gap-2 mb-2">- <Layers size={16} className="text-foreground" />- <h3 className="text-base font-medium">Table quickstarts</h3>- </div>- <p className="text-sm text-foreground-lighter">- Select a pre-built schema to get started quickly.- </p>- </div>-- <div className="space-y-3">- <div className="flex flex-wrap gap-2">- {CATEGORIES.map((category) => (- <button- key={category}- onClick={() => handleCategorySelect(category)}- disabled={disabled}- role="tab"- aria-selected={activeCategory === category}- aria-label={`${category} templates category`}- className={cn(- 'px-3 py-1.5 rounded-md text-sm capitalize border transition-all',- activeCategory === category- ? 'border-foreground bg-surface-200 text-foreground'- : 'border-default hover:border-foreground-muted hover:bg-surface-100 text-foreground-light',- 'disabled:opacity-50 disabled:cursor-not-allowed'- )}- >- {category}- </button>- ))}- </div>-- {displayedTemplates.length > 0 && (- <div className="grid gap-2 pt-1">- {displayedTemplates.map((template) => (- <button- key={`${activeCategory}:${template.tableName}`}- onClick={() => handleSelectTemplate(template)}- disabled={disabled}- aria-label={`Select ${template.tableName} template with ${template.fields.length} fields`}- className={cn(- 'text-left p-3 rounded-md border transition-colors w-full bg-surface-100',- 'border-light hover:border-default hover:bg-surface-200 cursor-pointer',- 'disabled:opacity-50 disabled:cursor-not-allowed'- )}- >- <div className="flex items-start gap-3">- <div className="rounded-full bg-alternative border w-8 h-8 flex items-center justify-center flex-shrink-0">- <Table2 size={16} className="text-foreground" />- </div>- <div className="flex-1 min-w-0">- <div className="text-sm font-medium text-foreground mb-0">- {template.tableName}- </div>- {template.rationale && (- <div className="text-xs text-foreground-light mt-0.5">- {template.rationale}- </div>- )}- </div>- <Tooltip>- <TooltipTrigger asChild>- <div className="flex items-center gap-1 text-sm text-foreground-muted ml-3">- <Columns3 size={14} aria-hidden="true" />- <span>{template.fields.length}</span>- </div>- </TooltipTrigger>- <TooltipContent>- {template.fields.length} {template.fields.length === 1 ? 'column' : 'columns'}- </TooltipContent>- </Tooltip>- </div>- </button>- ))}- </div>- )}- </div>- </div>- )-}diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/constants.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/constants.tsdeleted file mode 100644index d3ed011ad47..00000000000--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/constants.ts+++ /dev/null@@ -1,11 +0,0 @@-export const LIMITS = {- MAX_PROMPT_LENGTH: 500,- MAX_TABLES: 5,-} as const--export const AI_QUICK_IDEAS = [- 'Recipe sharing app',- 'Event ticketing system',- 'Fitness tracker',- 'Learning management platform',-] as constdiff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/templates.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/templates.tsdeleted file mode 100644index 27e101814b9..00000000000--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/templates.ts+++ /dev/null@@ -1,331 +0,0 @@-import { TableSource, TableSuggestion } from './types'--export const tableTemplates: Record<string, TableSuggestion[]> = {- 'Social Network': [- {- tableName: 'profiles',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'user_id', type: 'uuid', nullable: false, unique: true },- { name: 'username', type: 'text', nullable: true, unique: true },- { name: 'display_name', type: 'text', nullable: true },- { name: 'avatar_url', type: 'text', nullable: true },- { name: 'bio', type: 'text', nullable: true },- { name: 'location', type: 'text', nullable: true },- { name: 'website', type: 'text', nullable: true },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- { name: 'updated_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Stores user profile details such as name, avatar, and bio',- source: TableSource.TEMPLATE,- },- {- tableName: 'posts',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'author_id', type: 'uuid', nullable: false },- { name: 'content', type: 'text', nullable: false },- { name: 'image_url', type: 'text', nullable: true },- { name: 'likes_count', type: 'int4', nullable: false, default: '0' },- { name: 'comments_count', type: 'int4', nullable: false, default: '0' },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- { name: 'updated_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Stores user posts, images, and engagement counts',- source: TableSource.TEMPLATE,- },- {- tableName: 'follows',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'follower_id', type: 'uuid', nullable: false },- { name: 'following_id', type: 'uuid', nullable: false },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Tracks relationships between followers and followed users',- source: TableSource.TEMPLATE,- },- ],- 'E-commerce': [- {- tableName: 'products',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'name', type: 'text', nullable: false },- { name: 'slug', type: 'text', nullable: false, unique: true },- { name: 'description', type: 'text', nullable: true },- { name: 'price', type: 'numeric', nullable: false },- { name: 'compare_at_price', type: 'numeric', nullable: true },- { name: 'cost', type: 'numeric', nullable: true },- { name: 'sku', type: 'text', nullable: true, unique: true },- { name: 'barcode', type: 'text', nullable: true },- { name: 'stock_quantity', type: 'int4', nullable: false, default: '0' },- { name: 'weight', type: 'numeric', nullable: true },- { name: 'published', type: 'bool', nullable: false, default: 'false' },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- { name: 'updated_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Stores product details, pricing, and stock levels',- source: TableSource.TEMPLATE,- },- {- tableName: 'orders',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'order_number', type: 'text', nullable: false, unique: true },- { name: 'customer_id', type: 'uuid', nullable: false },- { name: 'status', type: 'text', nullable: false, default: 'pending' },- { name: 'subtotal', type: 'numeric', nullable: false },- { name: 'tax', type: 'numeric', nullable: false, default: '0' },- { name: 'shipping', type: 'numeric', nullable: false, default: '0' },- { name: 'total', type: 'numeric', nullable: false },- { name: 'notes', type: 'text', nullable: true },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- { name: 'updated_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Manages customer orders, payment totals, and statuses',- source: TableSource.TEMPLATE,- },- {- tableName: 'cart_items',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'user_id', type: 'uuid', nullable: false },- { name: 'product_id', type: 'uuid', nullable: false },- { name: 'quantity', type: 'int4', nullable: false, default: '1' },- { name: 'added_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Tracks products added to customer shopping carts',- source: TableSource.TEMPLATE,- },- ],- Blog: [- {- tableName: 'articles',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'title', type: 'text', nullable: false },- { name: 'slug', type: 'text', nullable: false, unique: true },- { name: 'content', type: 'text', nullable: true },- { name: 'excerpt', type: 'text', nullable: true },- { name: 'cover_image', type: 'text', nullable: true },- { name: 'author_id', type: 'uuid', nullable: false },- { name: 'status', type: 'text', nullable: false, default: "'draft'" },- { name: 'published_at', type: 'timestamptz', nullable: true },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- { name: 'updated_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Stores blog posts with author, status, and publish dates',- source: TableSource.TEMPLATE,- },- {- tableName: 'categories',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'name', type: 'text', nullable: false },- { name: 'slug', type: 'text', nullable: false, unique: true },- { name: 'description', type: 'text', nullable: true },- { name: 'color', type: 'text', nullable: true },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Organizes articles into categories or tags for filtering',- source: TableSource.TEMPLATE,- },- {- tableName: 'comments',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'article_id', type: 'uuid', nullable: false },- { name: 'author_name', type: 'text', nullable: false },- { name: 'author_email', type: 'text', nullable: false },- { name: 'content', type: 'text', nullable: false },- { name: 'approved', type: 'bool', nullable: false, default: 'false' },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Stores reader comments and approval status for moderation',- source: TableSource.TEMPLATE,- },- ],- 'To-Do List': [- {- tableName: 'tasks',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'title', type: 'text', nullable: false },- { name: 'description', type: 'text', nullable: true },- { name: 'completed', type: 'bool', nullable: false, default: 'false' },- { name: 'priority', type: 'text', nullable: true, default: 'medium' },- { name: 'due_date', type: 'date', nullable: true },- { name: 'user_id', type: 'uuid', nullable: false },- { name: 'list_id', type: 'uuid', nullable: true },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- { name: 'updated_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Stores user tasks with priorities, due dates, and status',- source: TableSource.TEMPLATE,- },- {- tableName: 'lists',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'name', type: 'text', nullable: false },- { name: 'description', type: 'text', nullable: true },- { name: 'color', type: 'text', nullable: true },- { name: 'icon', type: 'text', nullable: true },- { name: 'user_id', type: 'uuid', nullable: false },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- { name: 'updated_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Groups tasks into named lists for better organization',- source: TableSource.TEMPLATE,- },- {- tableName: 'subtasks',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'task_id', type: 'uuid', nullable: false },- { name: 'title', type: 'text', nullable: false },- { name: 'completed', type: 'bool', nullable: false, default: 'false' },- { name: 'position', type: 'int4', nullable: false, default: '0' },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Tracks smaller subtasks linked to a main task',- source: TableSource.TEMPLATE,- },- ],- Analytics: [- {- tableName: 'events',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'user_id', type: 'uuid', nullable: true },- { name: 'session_id', type: 'text', nullable: true },- { name: 'event_type', type: 'text', nullable: false },- { name: 'properties', type: 'jsonb', nullable: true },- { name: 'user_agent', type: 'text', nullable: true },- { name: 'ip_address', type: 'text', nullable: true },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Captures user events and properties for analytics tracking',- source: TableSource.TEMPLATE,- },- {- tableName: 'page_views',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'user_id', type: 'uuid', nullable: true },- { name: 'session_id', type: 'text', nullable: true },- { name: 'path', type: 'text', nullable: false },- { name: 'referrer', type: 'text', nullable: true },- { name: 'duration', type: 'int4', nullable: true },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Tracks user page views, referrers, and session info',- source: TableSource.TEMPLATE,- },- {- tableName: 'metrics',- fields: [- {- name: 'id',- type: 'uuid',- nullable: false,- isPrimary: true,- default: 'gen_random_uuid()',- },- { name: 'metric_name', type: 'text', nullable: false },- { name: 'value', type: 'numeric', nullable: false },- { name: 'tags', type: 'jsonb', nullable: true },- { name: 'timestamp', type: 'timestamptz', nullable: false, default: 'now()' },- { name: 'aggregation_period', type: 'text', nullable: true },- { name: 'created_at', type: 'timestamptz', nullable: false, default: 'now()' },- ],- rationale: 'Stores aggregated metrics and KPIs with timestamps',- source: TableSource.TEMPLATE,- },- ],-}diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/types.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/types.tsdeleted file mode 100644index 331b163d31e..00000000000--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/types.ts+++ /dev/null@@ -1,64 +0,0 @@-export type PostgresType =- | 'text'- | 'varchar'- | 'uuid'- | 'int2'- | 'int4'- | 'int8'- | 'float4'- | 'float8'- | 'numeric'- | 'bool'- | 'json'- | 'jsonb'- | 'date'- | 'time'- | 'timestamp'- | 'timestamptz'- | 'timetz'- | 'bytea'--export type TableField = {- name: string- type: PostgresType- nullable?: boolean- unique?: boolean- default?: string // Must be string for table editor compatibility- description?: string- isPrimary?: boolean-}--export enum TableSource {- AI = 'ai',- TEMPLATE = 'template',-}--export enum QuickstartVariant {- CONTROL = 'control',- AI = 'ai',- TEMPLATES = 'templates',- ASSISTANT = 'assistant',-}--export type TableSuggestion = {- tableName: string- fields: TableField[]- rationale?: string- source: TableSource-}--export type AIGeneratedSchema = {- tables: Array<{- name: string- description: string- columns: Array<{- name: string- type: string- isPrimary?: boolean- isNullable?: boolean- defaultValue?: string- isUnique?: boolean- }>- }>- summary: string-}diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/useAITableGeneration.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/useAITableGeneration.tsdeleted file mode 100644index 955f931b368..00000000000--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/useAITableGeneration.ts+++ /dev/null@@ -1,307 +0,0 @@-import { constructHeaders, fetchHandler } from 'data/fetchers'-import { useLocalStorage } from 'hooks/misc/useLocalStorage'-import { BASE_PATH } from 'lib/constants'-import { useCallback, useEffect, useRef, useState } from 'react'-import { toast } from 'sonner'-import { LIMITS } from './constants'-import type { AIGeneratedSchema, PostgresType, TableSuggestion } from './types'-import { TableSource } from './types'--const AI_TABLES_STORAGE_KEY = 'table-quickstart-ai-results'-const MAX_BUFFER_SIZE = 50 * 1024 // 50KB limit for streaming responses--type PartialColumn = Partial<AIGeneratedSchema['tables'][number]['columns'][number]>-type PartialTable = Partial<AIGeneratedSchema['tables'][number]> & {- columns?: PartialColumn[]-}-type PartialSchema = Partial<AIGeneratedSchema> & {- tables?: PartialTable[]-}--interface AITableGenerationState {- prompt: string- tables: TableSuggestion[]-}--const isNotNull = <T>(value: T | null | undefined): value is T => value != null--const isIdColumn = (name: string) => name === 'id'--const isPrimaryColumn = (column: { isPrimary?: boolean | null; name: string }) =>- column.isPrimary || isIdColumn(column.name)--const getColumnDescription = (column: { isPrimary?: boolean | null; name: string }) => {- if (isPrimaryColumn(column)) return 'Primary key'- return undefined-}--const mapColumnType = (type: string): PostgresType => {- const typeMap: Record<string, PostgresType> = {- bigint: 'int8',- integer: 'int4',- smallint: 'int2',- boolean: 'bool',- text: 'text',- varchar: 'varchar',- uuid: 'uuid',- timestamp: 'timestamp',- timestamptz: 'timestamptz',- 'timestamp with time zone': 'timestamptz',- date: 'date',- time: 'time',- timetz: 'timetz',- 'time with time zone': 'timetz',- json: 'json',- jsonb: 'jsonb',- numeric: 'numeric',- real: 'float4',- 'double precision': 'float8',- bytea: 'bytea',- }-- return typeMap[type.toLowerCase()] || 'text'-}--const convertAISchemaToTableSuggestions = (schema: AIGeneratedSchema): TableSuggestion[] => {- return schema.tables.map((table) => ({- tableName: table.name,- fields: table.columns.map((column) => ({- name: column.name,- type: mapColumnType(column.type),- nullable: column.isNullable ?? undefined,- unique: column.isUnique ?? undefined,- default: column.defaultValue ?? undefined,- description: getColumnDescription(column),- isPrimary: column.isPrimary || isIdColumn(column.name) || undefined,- })),- rationale: table.description,- source: TableSource.AI,- }))-}--const convertPartialSchemaToTableSuggestions = (schema: PartialSchema): TableSuggestion[] => {- if (!Array.isArray(schema.tables)) return []-- return schema.tables- .map((table, tableIndex) => {- if (!table) return null-- const tableName =- typeof table.name === 'string' && table.name.trim().length > 0- ? table.name- : `table_${tableIndex + 1}`- const columns = Array.isArray(table.columns) ? table.columns : []-- const fields = columns- .map((column, columnIndex) => {- if (!column) return null-- const columnName =- typeof column.name === 'string' && column.name.trim().length > 0- ? column.name- : `column_${columnIndex + 1}`- const columnType =- typeof column.type === 'string' && column.type.trim().length > 0 ? column.type : 'text'-- return {- name: columnName,- type: mapColumnType(columnType),- nullable: column.isNullable ?? undefined,- unique: column.isUnique ?? undefined,- default: column.defaultValue ?? undefined,- description: getColumnDescription({ ...column, name: columnName }),- isPrimary: column.isPrimary || isIdColumn(columnName) || undefined,- }- })- .filter(isNotNull)-- if (fields.length === 0 && !table.name) {- return null- }-- return {- tableName,- fields,- rationale: typeof table.description === 'string' ? table.description : undefined,- source: TableSource.AI,- }- })- .filter(isNotNull)-}--const safeJsonParse = <T>(input: string): T | null => {- try {- return JSON.parse(input) as T- } catch {- return null- }-}--export const useAITableGeneration = () => {- const [isGenerating, setIsGenerating] = useState(false)- const [error, setError] = useState<string | null>(null)- const [state, setState] = useLocalStorage<AITableGenerationState>(AI_TABLES_STORAGE_KEY, {- prompt: '',- tables: [],- })- const abortControllerRef = useRef<AbortController | null>(null)- const isMountedRef = useRef(true)-- useEffect(() => {- isMountedRef.current = true- return () => {- isMountedRef.current = false- if (abortControllerRef.current) {- abortControllerRef.current.abort()- }- }- }, [])-- const generateTables = useCallback(async (prompt: string): Promise<TableSuggestion[]> => {- if (abortControllerRef.current) {- abortControllerRef.current.abort()- }-- if (prompt.length > LIMITS.MAX_PROMPT_LENGTH) {- const message = `Your description is too long. Try shortening it to under ${LIMITS.MAX_PROMPT_LENGTH} characters.`- setError(message)- toast.error('Description too long', {- description: message,- })- return []- }-- const abortController = new AbortController()- abortControllerRef.current = abortController-- setIsGenerating(true)- setError(null)- setState({ prompt, tables: [] })-- try {- const headers = await constructHeaders()- headers.set('Content-Type', 'application/json')-- const response = await fetchHandler(`${BASE_PATH}/api/ai/table-quickstart/generate-schemas`, {- method: 'POST',- headers,- body: JSON.stringify({ prompt }),- signal: abortController.signal,- })-- if (!response.ok) {- const errorData = await response.json().catch(() => ({- error: 'Unable to generate table schema. Try again with a different description.',- }))- const errorMessage =- errorData?.error ||- 'Unable to generate table schema. Try again with a different description.'- if (isMountedRef.current) {- setError(errorMessage)- }- toast.error('Unable to generate tables', {- description: errorMessage,- })- return []- }-- if (!response.body) {- throw new Error('Response body is null')- }-- const reader = response.body.getReader()- const decoder = new TextDecoder()- let jsonBuffer = ''- let latestPartialSchema: PartialSchema = {}-- try {- while (true) {- const { done, value } = await reader.read()- if (done) break-- jsonBuffer += decoder.decode(value, { stream: true })-- if (jsonBuffer.length > MAX_BUFFER_SIZE) {- throw new Error('Response too large')- }-- const partialJson = safeJsonParse<PartialSchema>(jsonBuffer)- if (partialJson) {- Object.assign(latestPartialSchema, partialJson)- const partialSuggestions = convertPartialSchemaToTableSuggestions(latestPartialSchema)-- if (isMountedRef.current && partialSuggestions.length > 0) {- setState({ prompt, tables: partialSuggestions })- }- }- }- } finally {- reader.releaseLock()- }-- jsonBuffer += decoder.decode()-- const finalSchema = safeJsonParse<AIGeneratedSchema>(jsonBuffer)- const finalTables = finalSchema- ? convertAISchemaToTableSuggestions(finalSchema)- : convertPartialSchemaToTableSuggestions(latestPartialSchema)-- if (isMountedRef.current) {- setError(null)- setState({ prompt, tables: finalTables })- }-- return finalTables- } catch (error) {- if (error instanceof Error && error.name === 'AbortError') {- return []- }-- const message =- error instanceof Error ? error.message : 'Unable to generate tables. Please try again.'-- if (isMountedRef.current) {- setError(message)- }-- toast.error('Unable to generate tables', {- description: message,- })-- return []- } finally {- if (isMountedRef.current) {- setIsGenerating(false)- }- abortControllerRef.current = null- }- }, [])-- const clearTables = useCallback(() => {- if (abortControllerRef.current) {- abortControllerRef.current.abort()- abortControllerRef.current = null- }-- setIsGenerating(false)- setError(null)- setState({ prompt: '', tables: [] })- }, [])-- const setPrompt = useCallback(- (prompt: string) => {- setState((prev) => ({ ...prev, prompt }))- },- [setState]- )-- return {- generateTables,- isGenerating,- error,- prompt: state.prompt,- tables: state.tables,- setPrompt,- clearTables,- }-}diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/utils.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/utils.tsdeleted file mode 100644index 727d5b7ac5c..00000000000--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/utils.ts+++ /dev/null@@ -1,47 +0,0 @@-import type { TableSuggestion, TableField } from './types'-import type { ColumnField } from '../../SidePanelEditor.types'-import type { TableField as EditorTableField } from '../TableEditor.types'--export const DEFAULT_SCHEMA = 'public' as const--export function isPrimaryKeyField(field: TableField): boolean {- return field.isPrimary === true || field.name === 'id'-}--export function isIdentityField(field: TableField): boolean {- return field.name === 'id' && field.type.toLowerCase().includes('int') && !field.default-}--export function convertTableSuggestionToTableField(- table: TableSuggestion-): Partial<EditorTableField> {- const columns: ColumnField[] = table.fields.map((field, index) => {- const isPrimaryKey = isPrimaryKeyField(field)- const isIdentity = isIdentityField(field)- const defaultValue = field.default ? String(field.default) : null-- return {- id: `column-${index}`,- name: field.name,- format: field.type,- defaultValue,- isNullable: field.nullable !== false,- isUnique: field.unique ?? false,- isIdentity,- isPrimaryKey,- comment: field.description || '',- isNewColumn: true,- table: table.tableName,- schema: DEFAULT_SCHEMA,- check: null,- isArray: false,- isEncrypted: false,- }- })-- return {- name: table.tableName,- comment: table.rationale || '',- columns,- }-}diff --git a/apps/studio/components/layouts/Tabs/NewTab.tsx b/apps/studio/components/layouts/Tabs/NewTab.tsxindex 76acb8c3c35..7cda3aa234d 100644--- a/apps/studio/components/layouts/Tabs/NewTab.tsx+++ b/apps/studio/components/layouts/Tabs/NewTab.tsx@@ -3,33 +3,22 @@ import { partition } from 'lodash'import { Table2 } from 'lucide-react'import Link from 'next/link'import { useRouter } from 'next/router'-import { useEffect, useState } from 'react'import { toast } from 'sonner'-import { LOCAL_STORAGE_KEYS, useParams } from 'common'+import { useParams } from 'common'import { SQL_TEMPLATES } from 'components/interfaces/SQLEditor/SQLEditor.queries'import { createSqlSnippetSkeletonV2 } from 'components/interfaces/SQLEditor/SQLEditor.utils'-import { QuickstartAIWidget } from 'components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/QuickstartAIWidget'-import { QuickstartTemplatesWidget } from 'components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/QuickstartTemplatesWidget'-import { QuickstartVariant } from 'components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/types'import { useSendEventMutation } from 'data/telemetry/send-event-mutation'import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'-import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'import { useQuerySchemaState } from 'hooks/misc/useSchemaQueryState'import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'-import { usePHFlag } from 'hooks/ui/useFlag'import { useIsProtectedSchema } from 'hooks/useProtectedSchemas'-import { uuidv4 } from 'lib/helpers'import { useProfile } from 'lib/profile'-import { useTrack } from 'lib/telemetry/track'-import { AssistantMessageType, useAiAssistantStateSnapshot } from 'state/ai-assistant-state'-import { useSidebarManagerSnapshot } from 'state/sidebar-manager-state'import { useSqlEditorV2StateSnapshot } from 'state/sql-editor-v2'import { useTableEditorStateSnapshot } from 'state/table-editor'import { createTabId, useTabsStateSnapshot } from 'state/tabs'import {- AiIconAnimation,Button,SQL_ICON,TabsContent_Shadcn_,@@ -39,18 +28,9 @@ import {cn,} from 'ui'import { useEditorType } from '../editors/EditorsLayout.hooks'-import { SIDEBAR_KEYS } from '../ProjectLayout/LayoutSidebar/LayoutSidebarProvider'import { ActionCard } from './ActionCard'import { RecentItems } from './RecentItems'-const TABLE_QUICKSTART_FLAG = 'tableQuickstart'--const ASSISTANT_QUICKSTART_MESSAGES = {- user: 'Help me create a new database table for my project',- assistant:- "I'll help you create a database table. Please tell me:\n\n1. What does your application do?\n2. What kind of data do you want to store?\n\nI'll suggest a table structure that fits your requirements and help you create it directly in your database.",-}-export function NewTab() {const router = useRouter()const { ref } = useParams()@@ -64,18 +44,10 @@ export function NewTab() {const snap = useTableEditorStateSnapshot()const snapV2 = useSqlEditorV2StateSnapshot()const tabs = useTabsStateSnapshot()- const aiSnap = useAiAssistantStateSnapshot()- const { openSidebar } = useSidebarManagerSnapshot()- const [isCreatingChat, setIsCreatingChat] = useState(false)const [templates] = partition(SQL_TEMPLATES, { type: 'template' })const [quickstarts] = partition(SQL_TEMPLATES, { type: 'quickstart' })- const [hasTrackedExposure, setHasTrackedExposure] = useLocalStorageQuery(- LOCAL_STORAGE_KEYS.TABLE_QUICKSTART_EXPOSURE_TRACKED(String(profile?.id ?? 'anonymous')),- false- )const { mutate: sendEvent } = useSendEventMutation()- const track = useTrack()const { can: canCreateSQLSnippet } = useAsyncCheckPermissions(PermissionAction.CREATE,'user_content',@@ -85,88 +57,6 @@ export function NewTab() {})- /**- * Returns:- * - `QuickstartVariant`: user variation (`control`, `ai`, `templates`, `assistant`)- * - `false`: user not yet bucketed or not targeted for experiment- * - `undefined`: PostHog still loading- */- const tableQuickstartVariant = usePHFlag<QuickstartVariant | false | undefined>(- TABLE_QUICKSTART_FLAG- )-- const activeQuickstartVariant =- editor !== 'sql' &&- tableQuickstartVariant &&- tableQuickstartVariant !== QuickstartVariant.CONTROL- ? tableQuickstartVariant- : null-- const shouldTrackExposure =- editor !== 'sql' &&- !!profile?.id &&- tableQuickstartVariant !== false &&- tableQuickstartVariant !== undefined-- useEffect(() => {- if (shouldTrackExposure && !hasTrackedExposure) {- setHasTrackedExposure(true)- track('table_quickstart_opened', {- variant: tableQuickstartVariant,- })- }- }, [- shouldTrackExposure,- hasTrackedExposure,- setHasTrackedExposure,- tableQuickstartVariant,- track,- ])-- const handleOpenAssistant = () => {- if (isCreatingChat) return-- setIsCreatingChat(true)-- try {- openSidebar(SIDEBAR_KEYS.AI_ASSISTANT)- const chatId = aiSnap.newChat({- name: 'Create a database table',- })-- if (!chatId) {- track('table_quickstart_assistant_opened', {- chatCreated: false,- })- throw new Error('Failed to create chat')- }-- const userMessage: AssistantMessageType = {- id: uuidv4(),- role: 'user',- parts: [{ type: 'text', text: ASSISTANT_QUICKSTART_MESSAGES.user }],- }-- const assistantMessage: AssistantMessageType = {- id: uuidv4(),- role: 'assistant',- parts: [{ type: 'text', text: ASSISTANT_QUICKSTART_MESSAGES.assistant }],- }-- aiSnap.saveMessage([userMessage, assistantMessage])-- track('table_quickstart_assistant_opened', {- chatCreated: true,- })- } catch (error) {- console.error('Failed to open AI assistant:', error)- const message = error instanceof Error ? error.message : 'Unknown error'- toast.error(`Unable to open AI assistant: ${message}`)- } finally {- setIsCreatingChat(false)- }- }-const tableEditorActions = isSchemaLocked? []: [@@ -234,22 +124,7 @@ export function NewTab() {{actions.map((item, i) => (<ActionCard key={`action-card-${i}`} {...item} />))}- {activeQuickstartVariant === QuickstartVariant.ASSISTANT && (- <ActionCard- icon={<AiIconAnimation size={16} loading={isCreatingChat} />}- title="Create with Assistant"- description="Use AI to design your database table"- bgColor="bg-brand-200"- onClick={handleOpenAssistant}- />- )}</div>- {activeQuickstartVariant === QuickstartVariant.AI && (- <QuickstartAIWidget onSelectTable={(tableData) => snap.onAddTable(tableData)} />- )}- {activeQuickstartVariant === QuickstartVariant.TEMPLATES && (- <QuickstartTemplatesWidget onSelectTemplate={(tableData) => snap.onAddTable(tableData)} />- )}<RecentItems /></div>{editor === 'sql' && (diff --git a/apps/studio/hooks/misc/useRealtimeExperiment.ts b/apps/studio/hooks/misc/useRealtimeExperiment.tsdeleted file mode 100644index 34ed3729fbc..00000000000--- a/apps/studio/hooks/misc/useRealtimeExperiment.ts+++ /dev/null@@ -1,51 +0,0 @@-import { useTrackExperimentExposure } from 'hooks/misc/useTrackExperimentExposure'-import { usePHFlag } from 'hooks/ui/useFlag'-import { IS_PLATFORM } from 'lib/constants'-import { useMemo } from 'react'--export enum RealtimeButtonVariant {- CONTROL = 'control',- HIDE_BUTTON = 'hide-button',- TRIGGERS = 'triggers',-}--interface UseRealtimeExperimentOptions {- /** Whether the current context is a table (not a view/foreign table) */- isTable?: boolean- /** Whether realtime is currently enabled for the table */- isRealtimeEnabled?: boolean-}--interface UseRealtimeExperimentResult {- /** The active variant for this user, or null if not in experiment */- activeVariant: RealtimeButtonVariant | null-}--/**- * Hook to manage the realtime button A/B experiment.- * User targeting is handled via PostHog experiment configuration.- */-export function useRealtimeExperiment({- isTable = false,- isRealtimeEnabled = false,-}: UseRealtimeExperimentOptions): UseRealtimeExperimentResult {- const realtimeButtonVariant = usePHFlag<RealtimeButtonVariant>('realtimeButtonVariant')-- const activeVariant = useMemo(() => {- if (!IS_PLATFORM) return null- if (!isTable) return null- if (!realtimeButtonVariant) return null- if (realtimeButtonVariant === RealtimeButtonVariant.CONTROL) return null- return realtimeButtonVariant- }, [isTable, realtimeButtonVariant])-- const shouldTrack = IS_PLATFORM && isTable && !!realtimeButtonVariant-- useTrackExperimentExposure('realtime', shouldTrack ? realtimeButtonVariant : undefined, {- table_has_realtime_enabled: isRealtimeEnabled,- })-- return {- activeVariant,- }-}diff --git a/apps/studio/pages/api/ai/table-quickstart/generate-schemas.ts b/apps/studio/pages/api/ai/table-quickstart/generate-schemas.tsdeleted file mode 100644index 9ac5e29f834..00000000000--- a/apps/studio/pages/api/ai/table-quickstart/generate-schemas.ts+++ /dev/null@@ -1,129 +0,0 @@-import { streamObject } from 'ai'-import { NextApiRequest, NextApiResponse } from 'next'-import { z } from 'zod'--import { LIMITS } from 'components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableQuickstart/constants'-import { getModel } from 'lib/ai/model'-import apiWrapper from 'lib/api/apiWrapper'--export const maxDuration = 30--const ColumnSchema = z.object({- name: z.string().describe('The column name in snake_case'),- type: z.string().describe('PostgreSQL data type (e.g., bigint, text, timestamp with time zone)'),- isPrimary: z.boolean().optional().nullable().describe('Whether this is a primary key'),- isNullable: z.boolean().optional().nullable().describe('Whether the column can be null'),- defaultValue: z.string().optional().nullable().describe('Default value or expression'),- isUnique: z- .boolean()- .optional()- .nullable()- .describe('Whether the column has a unique constraint'),-})--const TableSchema = z.object({- name: z.string().describe('The table name in snake_case'),- description: z.string().describe('A brief description of what this table stores'),- columns: z.array(ColumnSchema).describe('Array of columns in the table'),-})--const ResponseSchema = z.object({- tables: z.array(TableSchema).describe('Array of related database tables for the application'),- summary: z.string().optional().describe('Brief summary of the generated schema'),-})--async function handler(req: NextApiRequest, res: NextApiResponse) {- const { method } = req-- switch (method) {- case 'POST':- return handlePost(req, res)- default:- res.setHeader('Allow', ['POST'])- res.status(405).json({- data: null,- error: { message: `Method ${method} Not Allowed` },- })- }-}--async function handlePost(req: NextApiRequest, res: NextApiResponse) {- const modelName = 'gpt-5-mini'- const modelResult = await getModel({- provider: 'openai',- model: modelName,- routingKey: 'table-quickstart',- isLimited: false,- })-- if (modelResult.error || !modelResult.model) {- return res.status(500).json({- error:- modelResult.error?.message || 'AI service temporarily unavailable. Try again in a moment.',- })- }-- const { model, providerOptions } = modelResult-- const { prompt } = req.body-- if (!prompt) {- return res.status(400).json({ error: 'Please provide a description of your app' })- }-- if (typeof prompt !== 'string' || prompt.length > LIMITS.MAX_PROMPT_LENGTH) {- return res.status(400).json({- error: `Description too long. Keep it under ${LIMITS.MAX_PROMPT_LENGTH} characters.`,- })- }-- try {- const abortController = new AbortController()- req.on('close', () => abortController.abort())- req.on('aborted', () => abortController.abort())-- const systemPrompt = `Generate exactly 3 core database tables.-- Schema rules:- - Primary key: id (uuid) with isPrimary: true, defaultValue: 'gen_random_uuid()'- - Timestamps: created_at, updated_at (timestamptz) with defaultValue: 'now()'- - Use text for strings, timestamptz for dates, bigint for integers- - snake_case naming-- Output rules (minimize tokens):- - ALWAYS include: name, type, isNullable- - Include isPrimary/isUnique/defaultValue ONLY when true/set- - Omit summary field`-- const userPrompt = `Application: ${prompt}`-- const result = streamObject({- model,- abortSignal: abortController.signal,- schema: ResponseSchema,- mode: 'json',- ...(providerOptions && { providerOptions }),- system: systemPrompt,- prompt: userPrompt,- })-- result.pipeTextStreamToResponse(res)- } catch (error) {- if (error instanceof Error) {- if (error.message.includes('context_length') || error.message.includes('too long')) {- return res.status(400).json({- error: 'Description too complex. Try using fewer words.',- })- }- }-- return res.status(500).json({- error: 'Unable to generate schema. Try a different description.',- })- }-}--const wrapper = (req: NextApiRequest, res: NextApiResponse) =>- apiWrapper(req, res, handler, { withAuth: true })--export default wrapperdiff --git a/apps/studio/proxy.ts b/apps/studio/proxy.tsindex 5ad9f17a8ae..27c941fb1c1 100644--- a/apps/studio/proxy.ts+++ b/apps/studio/proxy.ts@@ -17,7 +17,6 @@ const HOSTED_SUPPORTED_API_URLS = ['/ai/onboarding/design','/ai/feedback/classify','/ai/docs',- '/ai/table-quickstart/generate-schemas','/get-ip-address','/get-utc-time','/get-deployment-commit',diff --git a/packages/common/constants/local-storage.ts b/packages/common/constants/local-storage.tsindex 86475d95ba7..fbe0e142202 100644--- a/packages/common/constants/local-storage.ts+++ b/packages/common/constants/local-storage.ts@@ -118,10 +118,6 @@ export const LOCAL_STORAGE_KEYS = {* WWW*/BLOG_VIEW: 'supabase-blog-view',-- // Used to track if user has been exposed to table quickstart experiment (prevents duplicate exposure events)- TABLE_QUICKSTART_EXPOSURE_TRACKED: (userId: string) =>- `table-quickstart-exposure-tracked-${userId}`,} as constexport type LocalStorageKey = (typeof LOCAL_STORAGE_KEYS)[keyof typeof LOCAL_STORAGE_KEYS]diff --git a/packages/common/telemetry-constants.ts b/packages/common/telemetry-constants.tsindex 76b386b9fe0..8b0349c682c 100644--- a/packages/common/telemetry-constants.ts+++ b/packages/common/telemetry-constants.ts@@ -1750,26 +1750,6 @@ export interface HomeActivityStatClickedEvent {groups: TelemetryGroups}-/**- * User was exposed to the realtime experiment (shown or not shown the Enable Realtime button).- *- * @group Events- * @source studio- * @page /dashboard/project/{ref}/editor- */-export interface RealtimeExperimentExposedEvent {- action: 'realtime_experiment_exposed'- properties: {- /** The PostHog experiment/feature flag name */- experiment_id: 'realtimeButtonVariant'- /** The experiment variant shown to the user */- variant: 'control' | 'hide-button' | 'triggers'- /** Whether the table already has realtime enabled */- table_has_realtime_enabled: boolean- }- groups: TelemetryGroups-}-/*** User clicked on a service title in Project Usage section of HomeV2.*@@ -2309,159 +2289,6 @@ export interface SidebarOpenedEvent {groups: TelemetryGroups}-/**- * User was exposed to the table quickstart experiment.- *- * @group Events- * @source studio- * @page /dashboard/project/{ref}/editor (NewTab)- */-export interface TableQuickstartOpenedEvent {- action: 'table_quickstart_opened'- properties: {- /**- * Which variation the user was shown: ai, templates, assistant, or control- */- variant: 'ai' | 'templates' | 'assistant' | 'control'- }- groups: TelemetryGroups-}-/**- * User submitted a prompt in the AI quickstart variation.- *- * @group Events- * @source studio- * @page /dashboard/project/{ref}/editor (QuickstartAIWidget)- */-export interface TableQuickstartAIPromptSubmittedEvent {- action: 'table_quickstart_ai_prompt_submitted'- properties: {- /**- * Length of the AI prompt- */- promptLength: number- /**- * Whether this was triggered by a quick idea button- */- wasQuickIdea: boolean- }- groups: TelemetryGroups-}--/**- * AI table generation completed (success or failure).- *- * @group Events- * @source studio- * @page /dashboard/project/{ref}/editor (QuickstartAIWidget)- */-export interface TableQuickstartAIGenerationCompletedEvent {- action: 'table_quickstart_ai_generation_completed'- properties: {- /**- * Whether generation succeeded- */- success: boolean- /**- * Number of tables generated (0 if failed)- */- tablesGenerated: number- /**- * Length of the prompt used- */- promptLength: number- /**- * Error message if failed- */- errorMessage?: string- }- groups: TelemetryGroups-}--/**- * User clicked a quick idea button in the AI variation.- *- * @group Events- * @source studio- * @page /dashboard/project/{ref}/editor (QuickstartAIWidget)- */-export interface TableQuickstartQuickIdeaClickedEvent {- action: 'table_quickstart_quick_idea_clicked'- properties: {- /**- * Text of the quick idea clicked- */- ideaText: string- }- groups: TelemetryGroups-}--/**- * User selected a category in the templates variation.- *- * @group Events- * @source studio- * @page /dashboard/project/{ref}/editor (QuickstartTemplatesWidget)- */-export interface TableQuickstartCategoryClickedEvent {- action: 'table_quickstart_category_clicked'- properties: {- /**- * Name of the category clicked- */- categoryName: string- }- groups: TelemetryGroups-}--/**- * User selected a table template from either AI-generated suggestions or pre-made templates.- *- * @group Events- * @source studio- * @page /dashboard/project/{ref}/editor (QuickstartAIWidget, QuickstartTemplatesWidget)- */-export interface TableQuickstartTemplateClickedEvent {- action: 'table_quickstart_template_clicked'- properties: {- /**- * Name of the table clicked- */- tableName: string- /**- * Number of columns in the template- */- columnCount: number- /**- * Source of the template clicked- */- source: 'ai' | 'templates'- /**- * Category the template belongs to (only present for templates source)- */- categoryName?: string- }- groups: TelemetryGroups-}--/**- * User clicked the assistant button in the assistant variation.- *- * @group Events- * @source studio- * @page /dashboard/project/{ref}/editor (NewTab)- */-export interface TableQuickstartAssistantOpenedEvent {- action: 'table_quickstart_assistant_opened'- properties: {- /**- * Whether the assistant chat was successfully created- */- chatCreated: boolean- }- groups: TelemetryGroups-}-/*** User toggled the inline editor setting in account preferences.*@@ -2893,7 +2720,6 @@ export type TelemetryEvent =| HomeGettingStartedClosedEvent| HomeSectionRowsMovedEvent| HomeActivityStatClickedEvent- | RealtimeExperimentExposedEvent| HomeProjectUsageServiceClickedEvent| HomeProjectUsageChartClickedEvent| HomeCustomReportBlockAddedEvent@@ -2909,13 +2735,6 @@ export type TelemetryEvent =| RLSGeneratedPoliciesCreatedEvent| TableCreateGeneratePoliciesExperimentExposedEvent| TableCreateGeneratePoliciesExperimentConvertedEvent- | TableQuickstartOpenedEvent- | TableQuickstartAIPromptSubmittedEvent- | TableQuickstartAIGenerationCompletedEvent- | TableQuickstartQuickIdeaClickedEvent- | TableQuickstartCategoryClickedEvent- | TableQuickstartTemplateClickedEvent- | TableQuickstartAssistantOpenedEvent| AuthUsersSearchSubmittedEvent| CommandMenuOpenedEvent| CommandMenuSearchSubmittedEvent