sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Materialized Views don't support schema migrations

Open malonehedges opened this issue 3 years ago • 1 comments

Version

1.12.0

What happened?

The following migrations result in sqlc believing the materialized view exists in the main public schema, when it has in fact moved

I am running sqlc off the main branch.

-- migration 1:
CREATE MATERIALIZED VIEW something AS
select * from events
where event_type = 'sale'
order by created_at desc;


-- migration 2:
create schema computed_tables;
alter materialized view "something" set schema "computed_tables";


-- query:
-- name: SomeQuery :many
select id from "computed_tables"."something";

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

malonehedges avatar Mar 31 '22 04:03 malonehedges

I can work on it if it's ok for @kyleconroy

ludusrusso avatar Apr 04 '22 08:04 ludusrusso

Fixed in v1.23.0

kyleconroy avatar Oct 24 '23 23:10 kyleconroy