2019-12-11 15:21:47 -05:00
|
|
|
-- Add the column
|
2023-08-02 12:44:51 -04:00
|
|
|
ALTER TABLE site
|
|
|
|
ADD COLUMN enable_downvotes boolean DEFAULT TRUE NOT NULL;
|
|
|
|
|
|
|
|
ALTER TABLE site
|
|
|
|
ADD COLUMN open_registration boolean DEFAULT TRUE NOT NULL;
|
|
|
|
|
|
|
|
ALTER TABLE site
|
|
|
|
ADD COLUMN enable_nsfw boolean DEFAULT TRUE NOT NULL;
|
2019-12-11 15:21:47 -05:00
|
|
|
|
|
|
|
-- Reload the view
|
2023-08-02 12:44:51 -04:00
|
|
|
DROP VIEW site_view;
|
|
|
|
|
|
|
|
CREATE VIEW site_view AS
|
|
|
|
SELECT
|
|
|
|
*,
|
|
|
|
(
|
|
|
|
SELECT
|
|
|
|
name
|
|
|
|
FROM
|
|
|
|
user_ u
|
|
|
|
WHERE
|
|
|
|
s.creator_id = u.id) AS creator_name,
|
|
|
|
(
|
|
|
|
SELECT
|
|
|
|
count(*)
|
|
|
|
FROM
|
|
|
|
user_) AS number_of_users,
|
|
|
|
(
|
|
|
|
SELECT
|
|
|
|
count(*)
|
|
|
|
FROM
|
|
|
|
post) AS number_of_posts,
|
|
|
|
(
|
|
|
|
SELECT
|
|
|
|
count(*)
|
|
|
|
FROM
|
|
|
|
comment) AS number_of_comments,
|
|
|
|
(
|
|
|
|
SELECT
|
|
|
|
count(*)
|
|
|
|
FROM
|
|
|
|
community) AS number_of_communities
|
|
|
|
FROM
|
|
|
|
site s;
|
2019-12-11 15:21:47 -05:00
|
|
|
|