Skip to content

Commit f698cf0

Browse files
committed
refactor: simplify migration template to support Supabase forward-only migrations
1 parent ab8c881 commit f698cf0

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

bin/generator.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* Server-side commands:
1313
* - server route: Generates a new server-side route handler
14-
* - server migration: Generates a new database migration file
14+
* - server migration: Generates a new Supabase database migration file (forward-only)
1515
* - server controller: Generates a new server-side controller file
1616
*
1717
* Usage:
@@ -127,7 +127,7 @@ Client Commands:
127127
128128
Server Commands:
129129
route Generate a new server-side route handler
130-
migration Generate a new database migration file
130+
migration Generate a new Supabase database migration file (forward-only)
131131
controller Generate a new server-side controller file
132132
133133
Examples:
@@ -568,8 +568,8 @@ function generateServerMigration(args) {
568568
// Suggest next steps
569569
console.log('\nNext steps:');
570570
console.log('1. Edit the migration file to add your SQL commands');
571-
console.log('2. Apply the migration using the appropriate command');
572-
console.log(' Example: node bin/apply-migration.js');
571+
console.log('2. Apply the migration using Supabase CLI or your deployment process');
572+
console.log(' Note: Supabase only supports forward migrations (no DOWN methods)');
573573
} catch (error) {
574574
throw error;
575575
}
@@ -582,7 +582,8 @@ function showServerMigrationHelp() {
582582
console.log(`
583583
Server Migration Generator
584584
585-
Generates a new SQL migration file with a timestamp prefix.
585+
Generates a new SQL migration file with a timestamp prefix for Supabase.
586+
Note: Supabase does not support DOWN methods, so only forward migrations are generated.
586587
587588
Usage:
588589
node bin/generator.js server migration --name="add_user_fields"
Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
-- Migration: {{migrationName}}
22
-- Created at: {{timestamp}}
33

4-
---------------------------------------------------------------------------
5-
-- UP MIGRATION - Changes to apply
6-
---------------------------------------------------------------------------
7-
8-
-- Example up migration:
4+
-- Example migration:
95
-- CREATE TABLE new_table (
106
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
117
-- created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
128
-- name TEXT NOT NULL
139
-- );
1410

15-
-- Write your up migration SQL here:
16-
17-
18-
19-
---------------------------------------------------------------------------
20-
-- DOWN MIGRATION - How to revert the changes (for rollbacks)
21-
---------------------------------------------------------------------------
22-
23-
-- Example down migration:
24-
-- DROP TABLE IF EXISTS new_table;
25-
26-
-- Write your down migration SQL here:
11+
-- Write your migration SQL here:
2712

0 commit comments

Comments
 (0)