xataio / pgroll

PostgreSQL zero-downtime migrations made easy

Home Page:https://www.xata.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New Tables created are considering as views.

althaf004 opened this issue · comments

hi,

To test pgroll, i had took an example from examples json.
I have initialized the db and run the start command. With the new schema created, all the existing tables from older schema is considered as views.

Please refer below screenshots.
image

Hi @althaf004 👋

This is expected behaviour. When a migration is started a new schema is created (public_01_create_tables in this case). Inside the new schema are views corresponding to each of the tables in the public schema.

If you were to complete this migration (with pgroll complete) and start another one, you would have a second schema (eg 02_create_another_table) containing a different set of views.

The idea is that applications will access the views in these versioned schema rather than accessing the tables in the public schema directly. This would be done by setting the Postgres search_path to the schema name as explained in the docs.

Closing this as there is no issue to solve