codeforjapan / hackdays

Next version of Social Hackday website.
hackdays-c4j.vercel.app
6 stars 0 forks source link

[Temporarily resolved] moddatetime not found in local environment #31

Open MaySoMusician opened 2 years ago

MaySoMusician commented 2 years ago

Describe the bug

EXECUTE FUNCTION extensions.moddatetime(...) in database migrations fails because the 'moddatetime' extension does not exist.

To Reproduce

  1. Clone the repository and checkout https://github.com/codeforjapan/hackdays/commit/7e3300bb21e3c93d43ee1a220e6b748bcd0f03aa
  2. Restart Supabase local environment (supabase stop && supabase start)
  3. You will get the following error:

    Error: Error starting database: ERROR: function extensions.moddatetime() does not exist

Expected behavior

Supabase local environment gets running without any error

Screenshots

image

Desktop (please complete the following information):

Additional context

Unfortunately, we have only a temporary workaround for now, according to the repository of Supabase CLI (e.g. https://github.com/supabase/cli/issues/151)

Temporary Workaround 1 (old - no needed any more)

We assume we have supabase/migrations/20220218124404_commitUpdateAtChangesOnProjects.sql

  1. Create a migration file manually, that is named with the previous number (in this case, supabase/migrations/20220218124403_foobar.sql)
  2. Edit the file as below:
    CREATE EXTENSION IF NOT EXISTS moddatetime
        SCHEMA "extensions";
MaySoMusician commented 2 years ago

30 now fixes the problem temporarily. However, the current migrations will leads to fail to push the migrations to the hosted instance

MaySoMusician commented 2 years ago

Also refer to:

MaySoMusician commented 2 years ago

30 now fixes the problem temporarily. However, the current migrations will leads to fail to push the migrations to the hosted instance

An elevated postgres user can work around this problem.

Steps: