supabase-tenant-rbac icon indicating copy to clipboard operation
supabase-tenant-rbac copied to clipboard

Upgrading to 4.0.0 fails on Github Actions but works locally

Open ScissorHill opened this issue 1 year ago • 1 comments

I've followed this guide for setting up a CI/CD pipeline. I have a production and staging instance running for a while now. However, RBAC is on version 0.0.2. I'd like to upgrade to 4.0.0.

I have a migration file with the following lines in it:

DROP EXTENSION "pointsource-supabase_rbac";
CREATE EXTENSION "pointsource-supabase_rbac" VERSION '4.0.0';

When I do supabase db reset on my local machine, I get RBAC 4.0.0 running properly. But when I push this to staging, I get the following error on Github Actions:

ERROR: extension "pointsource-supabase_rbac" has no installation script nor update path for version "4.0.0" (SQLSTATE 22023)

Any suggestions on how this could be resolved?

ScissorHill avatar Jun 01 '24 16:06 ScissorHill

Update: A bit of trial and error got it working.

Any attempts to install 4.0.0 on the remote instance lead to the following error: ERROR: function moddatetime() does not exist (SQLSTATE 42883) Not sure, but this could be the root of the previous error.

It looks like previous versions expected moddatetime to be installed with the schema extensions but 4.0.0 expects it with the public schema.

The working migration file, edited manually (the diff didn't work for me):

DROP EXTENSION IF  EXISTS "pointsource-supabase_rbac";
DROP EXTENSION IF  EXISTS "moddatetime";
CREATE EXTENSION IF NOT EXISTS moddatetime
	SCHEMA "public";
select dbdev.install('pointsource-supabase_rbac');
create extension "pointsource-supabase_rbac"
    version '4.0.0';

ScissorHill avatar Jun 04 '24 14:06 ScissorHill