technologiestiftung / zms-supabase

Supabase backend and db setup for the ZMS project
MIT License
1 stars 0 forks source link

All Contributors

ZMS Bürgeramt Prototyp Supabase Backend

This is the backend for the ZMS Prototyp Bürgeramt project.

Prerequisites

Installation

  1. Clone the repository
  2. Run supabase start

Usage or Deployment

  1. Link to existing supabase project or create a new one supabase link --project-ref 123qwertz
  2. Start the local database supabase start
  3. Push the local state to the remote

Realtime

To make realtime subscriptions to the tables work you need to run this sql query in the database:

-- See https://supabase.com/docs/guides/realtime/postgres-changes
BEGIN;
-- remove the supabase_realtime publication
DROP publication IF EXISTS supabase_realtime;
-- re-create the supabase_realtime publication with no tables
CREATE publication supabase_realtime;
COMMIT;

-- add a table to the publication
ALTER publication supabase_realtime
    ADD TABLE processes;

ALTER TABLE processes REPLICA IDENTITY
    FULL;

Cron Jobs for score Computation

Adding the cron extension to the migrations did create some errors in local development. To fix this, the following steps are necessary:

When you have a remote database running got to the database settings under https://app.supabase.com/project/<YOUR PROJECT ID>/database/extensions and enable the cron extension.

Then run the following SQL query in the database:

SELECT
    cron.schedule ('update processes scores every minute', '* * * * *', $$
        SELECT
            public.compute_scores () $$);

This creates a new cronjob that runs the function public.compute_scores every minute.

Development

Tests

Contributing

Before you create a pull request, write an issue so we can discuss your changes.

Contributors

Thanks goes to these wonderful people (emoji key):

Fabian Morón Zirfas
Fabian Morón Zirfas

📖 💻 🎨 🚇 🤔
Lucas Vogel
Lucas Vogel

📖 🤔 👀 💻
Ingo Hinterding
Ingo Hinterding

📖 🤔 👀

This project follows the all-contributors specification. Contributions of any kind welcome!

Content Licencing

Texts and content available as CC BY.

Illustrations by Maria Musterfrau, all rights reserved.

Credits

Made by

A project by

Supported by

Related Projects