The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
adds migrations table sql
Alaister Young8d3439363bd0
diff --git a/studio/lib/integration-utils.ts b/studio/lib/integration-utils.tsindex 8336470c685..63f9a93969f 100644--- a/studio/lib/integration-utils.ts+++ b/studio/lib/integration-utils.ts@@ -63,14 +63,15 @@ export async function getInitialMigrationSQLFromGitHubRepo(}const seedFileUrl = supabaseFilesResponse.find((file) => file.name === 'seed.sql')?.download_url- const migrationFileDownloadUrlPromises = migrationFilesResponse- .sort((a, b) => {- // sort by name ascending- if (a.name < b.name) return -1- if (a.name > b.name) return 1- return 0- })- .map((file) => fetchGitHub<string>(file.download_url, false))+ const sortedFiles = migrationFilesResponse.sort((a, b) => {+ // sort by name ascending+ if (a.name < b.name) return -1+ if (a.name > b.name) return 1+ return 0+ })+ const migrationFileDownloadUrlPromises = sortedFiles.map((file) =>+ fetchGitHub<string>(file.download_url, false)+ )const [seedFileResponse, ...migrationFileResponses] = await Promise.all([seedFileUrl ? fetchGitHub<string>(seedFileUrl, false) : Promise.resolve<string>(''),@@ -83,5 +84,32 @@ export async function getInitialMigrationSQLFromGitHubRepo(const seed =typeof seedFileResponse === 'object' && 'error' in seedFileResponse ? '' : seedFileResponse- return `${migrations};${seed}`+ const migrationsTableSql = /* SQL */ `+ create schema if not exists supabase_migrations;+ create table if not exists supabase_migrations.schema_migrations (+ version text not null primary key,+ statements text[],+ name text+ );+ ${sortedFiles.map((file, i) => {+ const migration = migrationFileResponses[i]+ if (!migration || (typeof migration === 'object' && 'error' in migration)) return ''++ const version = file.name.split('_')[0]+ const statements = JSON.stringify(+ migration+ .split(';')+ .map((statement) => statement.trim())+ .filter(Boolean)+ )++ return /* SQL */ `+ insert into supabase_migrations.schema_migrations (version, statements, name)+ select '${version}', array_agg(jsonb_statements)::text[], '${file.name}'+ from jsonb_array_elements_text($statements$${statements}$statements$::jsonb) as jsonb_statements;+ `+ })}+ `++ return `${migrations};${migrationsTableSql};${seed}`}diff --git a/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx b/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsxindex eb82bd7245f..d2162d8eadf 100644--- a/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx+++ b/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx@@ -197,7 +197,6 @@ const CreateProject = ({message: `Done fetching initial migrations`,})}- console.log('dbSql:', dbSql)let project: ProjectBase