Skip to content
This repository was archived by the owner on Feb 24, 2024. It is now read-only.
This repository was archived by the owner on Feb 24, 2024. It is now read-only.

Recommend using views for abstraction, but don't enforce it from the beginning #531

Open
@steve-chavez

Description

@steve-chavez

Currently on https://postgrest.org/en/latest/schema_structure.html#schema-isolation

It is recommended that you don’t expose tables on your API schema. Instead expose views and stored procedures which insulate the internal details from the outside world.

We recommend wrapping all tables in views from the get-go, however that has a considerable maintenance impact(more db objects) specially at the beginning of a project. There's nothing wrong in doing:

-- moving a table to a private schema and replacing it by a view
BEGIN;
ALTER TABLE api.projects SET SCHEMA private;
CREATE VIEW api.projects AS SELECT * FROM private.projects;
END;

At later stages of the project if some abstraction is needed.

Most real world cases have a combination of tables and views.

Metadata

Metadata

Assignees

No one assigned

    Labels

    explanationsbackground and context about how the project works.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions