mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-14 16:34:01 +00:00
be1389420b
* SQL format checking, 1. * SQL format checking, 2. * SQL format checking, 3. * SQL format checking, 4. * SQL format checking, 5. * Running pg_format * Getting rid of comment. * Upping pg_format version. * Using git ls-files for sql format check. * Fixing sql lints. * Addressing PR comments.
46 lines
879 B
SQL
46 lines
879 B
SQL
-- Add the column
|
|
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;
|
|
|
|
-- Reload the view
|
|
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;
|
|
|