I am using DBIx :: Class :: Schema :: Versioned and I want to create a new table view in the database. Setting __PACKAGE__->result_source_instance->is_virtual(1); correctly uses the definition of a view from the schema (without creating a table), but when I set __PACKAGE__->result_source_instance->is_virtual(0); , a table is not created in the database and an attempt to get a result set causes an error "relation does not exist" (which was expected).
I could not find in the documentation any link to how views should be created in DBIx :: Class :: Schema :: Versioned. What happens when I run the difference between the old version that does not contain the view and the new version, the sql/MyProject-Schema-38-PostgreSQL.sql file contains code to create the view:
-- View: unlocked_pages DROP VIEW unlocked_pages; CREATE VIEW unlocked_pages ( page_id, username ) AS ...
but then the file that contains the difference between version 2 looks empty, so when updating the scheme nothing is done except adding the new version number to dbix_class_schema_versions. This is the content of sql / MyProject-Schema-37-38-PostgreSQL.sql:
-- Convert schema 'sql/MyProject-Schema-37-PostgreSQL.sql' to 'sql/MyProject-Schema-38-PostgreSQL.sql':; -- No differences found;
I am using postgresql, and the definition is in Schema.pm
package MyProject::Schema;
Any help is much appreciated!
source share