Skip to content

supabase db push bails with false positive when using COMMIT; BEGIN; #5047

@njbmartin

Description

@njbmartin

Describe the bug
Using COMMIT; BEGIN; within a migration file (eg. to separate enum updates so they can be used in the same file with UPDATE / INSERT) shows a warning and appears to be successful, but does not apply anything below BEGIN; or any subsequent migration files. Running supabase db push again will show the same migration files waiting to be pushed.

ALTER TYPE tech_tree_vehicle_filter ADD VALUE IF NOT EXISTS 'cruise';

COMMIT;
BEGIN;

UPDATE tech_tree_nodes
SET vehicle_filter = 'courier'
WHERE key IN (
  'courier_route_optimiser',
  'courier_max_stops_10',
  'courier_electric_subsidy',
  'courier_locker_network',
  'courier_b2b_accounts',
  'courier_returns_specialist'
);

Note: I'm aware that transactions need to be wrapped properly, but because this didn't error, I didn't catch the issue and wondered why many of my subsequent migrations weren't actually applied.

To Reproduce
Steps to reproduce the behavior:

  1. Add COMMIT; BEGIN; to xxx_01.sql eg. to separate enums to use the value later in the file (INSERT / UPDATE)
  2. Create another migration file without
  3. Get the following:
WARNING (25P01): there is no transaction in progress
Applying migration xxx_02.sql...
Finished supabase db push.

Expected behavior
THE CLI should bail with an error, not a warning.

System information
Rerun the failing command with --create-ticket flag.

  • Ticket ID: N/A
  • Version of OS: Ubuntu 24.04
  • Version of CLI: 2.84.7
  • Version of Docker: Docker version 29.3.1, build c2be9cc
  • Versions of services: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions