@@ -2,7 +2,7 @@ import fs from 'fs';
22import path from 'path' ;
33import { createRequire } from 'module' ;
44import { fileURLToPath } from 'url' ;
5- import { log , confirm , note } from '@clack/prompts' ;
5+ import { log , confirm } from '@clack/prompts' ;
66import chalk from 'chalk' ;
77
88// Get the directory name in ES modules
@@ -231,38 +231,9 @@ export async function copyMigrations({
231231 }
232232 }
233233
234- // If no files to copy, show message with details and return false (no changes made)
234+ // If no files to copy, show message and return false (no changes made)
235235 if ( filesToCopy . length === 0 ) {
236- // Show success message
237- log . success ( 'All pgflow migrations are already in place' ) ;
238-
239- // Show details of already installed migrations
240- if ( skippedFiles . length > 0 ) {
241- const detailedMsg = [
242- 'Already installed migrations:' ,
243- ...skippedFiles . map ( ( file ) => {
244- // Find the matching existing file to show how it was installed
245- const matchingFile = existingFiles . find ( ( existingFile ) =>
246- existingFile . includes ( file )
247- ) ;
248-
249- if ( matchingFile === file ) {
250- // Installed with old direct method
251- return ` ${ chalk . dim ( '•' ) } ${ chalk . bold ( file ) } ` ;
252- } else {
253- // Installed with new timestamped method
254- const timestampPart =
255- matchingFile ?. substring ( 0 , matchingFile . indexOf ( file ) - 1 ) || '' ;
256- return ` ${ chalk . dim ( '•' ) } ${ chalk . dim (
257- timestampPart + '_'
258- ) } ${ chalk . bold ( file ) } `;
259- }
260- } ) ,
261- ] . join ( '\n' ) ;
262-
263- note ( detailedMsg , 'Existing pgflow Migrations' ) ;
264- }
265-
236+ log . success ( `All ${ skippedFiles . length } pgflow migrations are already in place` ) ;
266237 return false ;
267238 }
268239
@@ -276,48 +247,24 @@ export async function copyMigrations({
276247 file . destination = `${ baseTimestamp } _${ file . source } ` ;
277248 } ) ;
278249
279- log . info (
280- `Found ${ filesToCopy . length } migration${
281- filesToCopy . length !== 1 ? 's' : ''
282- } to install`
283- ) ;
284-
285- // Prepare summary message with colored output
286- const summaryParts = [ ] ;
287-
288- if ( filesToCopy . length > 0 ) {
289- summaryParts . push (
290- `${ chalk . green ( 'New migrations to install:' ) } \n${ filesToCopy
291- . map ( ( file ) => {
292- // Extract the timestamp part from the new filename
293- const newTimestamp = file . destination . substring ( 0 , 14 ) ;
294- // Format: dim timestamp + bright original name
295- return `${ chalk . green ( '+' ) } ${ file . source } → ${ chalk . dim (
296- newTimestamp + '_'
297- ) } ${ chalk . bold ( file . source ) } `;
298- } )
299- . join ( '\n' ) } `
300- ) ;
301- }
250+ // Build summary message with explanation - show all migrations
251+ const migrationLines = filesToCopy . map ( ( file ) => {
252+ return ` ${ chalk . bold ( file . source ) } ` ;
253+ } ) ;
302254
303- if ( skippedFiles . length > 0 ) {
304- summaryParts . push (
305- `${ chalk . yellow ( 'Already installed:' ) } \n${ skippedFiles
306- . map ( ( file ) => `${ chalk . yellow ( '•' ) } ${ file } ` )
307- . join ( '\n' ) } `
308- ) ;
309- }
255+ const summaryMsg = [
256+ `Add to ${ chalk . cyan ( 'migrations/' ) } ${ chalk . dim ( '(database schema for workflow engine)' ) } :` ,
257+ '' ,
258+ ...migrationLines ,
259+ ] . join ( '\n' ) ;
310260
311- // Show summary and ask for confirmation if not auto-confirming
312- note ( summaryParts . join ( '\n\n' ) , 'pgflow Migrations' ) ;
261+ log . info ( summaryMsg ) ;
313262
314263 let shouldContinue = autoConfirm ;
315264
316265 if ( ! autoConfirm ) {
317266 const confirmResult = await confirm ( {
318- message : `Install ${ filesToCopy . length } new migration${
319- filesToCopy . length !== 1 ? 's' : ''
320- } ?`,
267+ message : `Add ${ filesToCopy . length } migration${ filesToCopy . length !== 1 ? 's' : '' } ?` ,
321268 } ) ;
322269
323270 shouldContinue = confirmResult === true ;
@@ -336,18 +283,12 @@ export async function copyMigrations({
336283 fs . copyFileSync ( sourcePath1 , destinationPath ) ;
337284 }
338285
339- // Show detailed success message with styled filenames
340- const detailedSuccessMsg = [
341- `Installed ${ filesToCopy . length } migration${
342- filesToCopy . length !== 1 ? 's' : ''
343- } to your Supabase project:`,
344- ...filesToCopy . map ( ( file ) => {
345- const newTimestamp = file . destination . substring ( 0 , 14 ) ;
346- return ` ${ chalk . dim ( newTimestamp + '_' ) } ${ chalk . bold ( file . source ) } ` ;
347- } ) ,
286+ const successMsg = [
287+ `Installed ${ filesToCopy . length } migration${ filesToCopy . length !== 1 ? 's' : '' } ` ,
288+ ` ${ chalk . dim ( 'Learn more:' ) } ${ chalk . blue . underline ( 'https://pgflow.dev/concepts/data-model/' ) } ` ,
348289 ] . join ( '\n' ) ;
349290
350- log . success ( detailedSuccessMsg ) ;
291+ log . success ( successMsg ) ;
351292
352293 return true ; // Return true to indicate migrations were copied
353294}
0 commit comments