cli icon indicating copy to clipboard operation
cli copied to clipboard

`supabase restart` command

Open Marviel opened this issue 3 years ago • 4 comments

Feature request

Is your feature request related to a problem? Please describe.

I have found myself, when debugging initial migrations, wanting to do supabase stop and supabase start right after one another.

For convenience, it would be nice to have a supabase restart command, equivalent to supabase stop && supabase start in a UNIX system.

Marviel avatar Apr 03 '22 21:04 Marviel

Hmm, I'm not sure this warrants a new command. Wouldn't a shell alias or command history + completion do a better job?

cc @parrotmac

soedirgo avatar Apr 14 '22 02:04 soedirgo

This could definitely by an x, y problem, so I’ll expand on my situation.

I recently work on taking an existing (pre-Go-cli) project and migrating it to be usable locally. I found myself trying something, getting an error when running “supabase start”, making a tweak, then instinctively running “supabase start” again to test the changes. However, I’d get an error because the project was already “up” (but broken).

As I’m thinking about it more, perhaps an alternative approach is to have the CLI tear-down resources upon error. IMHO this would be more expected.

Another option could be to provide a “reinit” sort of command that’s targeted at just rebuilding the DB portion of the stack.

parrotmac avatar Apr 14 '22 04:04 parrotmac

Got it, thanks for sharing your situation! The CLI should be tearing down resources on error, but I also noticed this sometimes doesn't work, specifically when there is an error during db startup. Do you mind creating another issue to track this?

soedirgo avatar Apr 14 '22 04:04 soedirgo

I use a quick shell script to do something similar which is handy for running supabase locally with an npm script.

#!/bin/bash

supabase start

finish()
{
    supabase stop
    exit
}
trap finish SIGINT

while :; do
    sleep 60
    echo "Supabase heartbeat..."
done

lukebussey avatar May 11 '22 00:05 lukebussey

Closing this as we decided to fix the underlying issue instead. supabase start && supabase stop is expected to properly tear down existing containers.

soedirgo avatar Sep 29 '22 07:09 soedirgo