cli icon indicating copy to clipboard operation
cli copied to clipboard

Migration issue with supabase db diff for partition tables

Open HimaniShah1 opened this issue 1 year ago • 3 comments

Describe the bug supabase db diff command gives an error when creating a migration on db that contains partition table. A new partition table is generated every month and for incremental migrations, it is creating an issue.

To Reproduce Steps to reproduce the behavior:

  1. Create a db with partition table
  2. dump it and create the first migration
  3. create another table in that partition table
  4. run supabase db diff (to create a new migration)

Expected behavior A new migration file with the updated changes should be created.

System information

  • Version of CLI: Tried with both v1.226.4 and v2.0.0
  • Version of Docker: v27.3.1

Error Log error diffing schema: error running container: exit 1:
Traceback (most recent call last):
File "/usr/local/bin/migra", line 8, in
sys.exit(do_command())
File "/usr/local/lib/python3.9/site-packages/migra/command.py", line 121, in do_command
status = run(args)
File "/usr/local/lib/python3.9/site-packages/migra/command.py", line 98, in run
m.add_all_changes(privileges=args.with_privileges)
File "/usr/local/lib/python3.9/site-packages/migra/migra.py", line 107, in add_all_changes
self.add(self.changes.tables_only_selectables())
File "/usr/local/lib/python3.9/site-packages/migra/changes.py", line 496, in get_selectable_changes
statements += get_table_changes(
File "/usr/local/lib/python3.9/site-packages/migra/changes.py", line 233, in get_table_changes
rls_alter = v.alter_rls_statement
File "/usr/local/lib/python3.9/site-packages/schemainspect/pg/obj.py", line 228, in alter_rls_statement
return self.alter_table_statement(self.alter_rls_clause)
File "/usr/local/lib/python3.9/site-packages/schemainspect/pg/obj.py", line 145, in alter_table_statement raise NotImplementedError # pragma: no cover
NotImplementedError

Additional context Seems like migra tool is creating an issue on policies. But happening only with partition table. It works fine if the tables are not partitioned.

HimaniShah1 avatar Dec 12 '24 04:12 HimaniShah1

@sweatybridge Could you please help me with this issue?

HimaniShah1 avatar Dec 12 '24 09:12 HimaniShah1

https://github.com/supabase/cli/issues/4562 - also have this problem

ProjectINT avatar Dec 01 '25 14:12 ProjectINT

@HimaniShah1 Do you solve this problem? I have similar

ProjectINT avatar Dec 01 '25 14:12 ProjectINT