Index: openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.3d12-1.3d13.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.3d12-1.3d13.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.3d12-1.3d13.sql 14 May 2016 17:33:02 -0000 1.1.2.1 +++ openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.3d12-1.3d13.sql 14 May 2016 17:51:26 -0000 1.1.2.2 @@ -2,17 +2,38 @@ -- Alter caveman style booleans (type character(1)) to real SQL boolean types. -- +drop view if exists forums_forums_enabled; +drop view if exists forums_messages_pending; +drop view if exists forums_messages_approved; + ALTER TABLE forums_forums - DROP constraint forums_enabled_p_ck, + DROP constraint IF EXISTS forums_enabled_p_ck, ALTER COLUMN enabled_p DROP DEFAULT, ALTER COLUMN enabled_p TYPE boolean USING enabled_p::boolean, ALTER COLUMN enabled_p SET DEFAULT true; ALTER TABLE forums_messages - DROP constraint forum_mess_open_p_ck, - ALTER COLUMN enabled_p DROP DEFAULT, - ALTER COLUMN enabled_p TYPE boolean - USING enabled_p::boolean, - ALTER COLUMN enabled_p SET DEFAULT true; + DROP constraint IF EXISTS forum_mess_open_p_ck, + ALTER COLUMN open_p DROP DEFAULT, + ALTER COLUMN open_p TYPE boolean + USING open_p::boolean, + ALTER COLUMN open_p SET DEFAULT true; +create view forums_forums_enabled +as + select * + from forums_forums + where enabled_p = true; + +create or replace view forums_messages_pending +as + select * + from forums_messages + where state= 'pending'; + +create or replace view forums_messages_approved +as + select * + from forums_messages + where state = 'approved';