sequelize-auto icon indicating copy to clipboard operation
sequelize-auto copied to clipboard

Capturing ignored postgres Materialized Views

Open duckboy81 opened this issue 1 year ago • 0 comments

Issue: Materialized Views are ignored when using --views

~Solution: Could either add another option flag --materializedViews OR update the existing showViewsQuery for postgres:~

https://github.com/sequelize/sequelize-auto/blob/8a8eb9d384851e5949ec19079300a2ebc33c2107/src/dialects/postgres.ts#L114

~Possible inject:~

    return `SELECT table_name, table_schema
             FROM information_schema.tables
            WHERE table_type = 'VIEW'
            AND table_schema NOT IN ('pg_catalog', 'information_schema')
              ${makeCondition("table_schema", schemaName)}

            UNION ALL

            SELECT matviewname AS table_name, schemaname AS table_schema
            FROM pg_matviews
            WHERE schemaname NOT IN ('pg_catalog', 'information_schema')
              ${makeCondition("schemaname", schemaName)}`;

EDIT: Nevermind, this fix will not work due to the way sequelize-auto looks for information about the table's construct.

duckboy81 avatar Aug 06 '24 16:08 duckboy81