summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-08-24 16:41:20 +0200
committerYorhel <git@yorhel.nl>2020-08-24 16:41:22 +0200
commita8a97a6a0bcb4ff36804b79280ba5c9263fe233b (patch)
tree4f20acfa90d79dcda6b66ac73f2c155dddca1b57
parentdda6647d207ea26800c5dbf3b326c88eccaa2c66 (diff)
reviews: Get rid of summary field & split mini/full reviews
Much to my disappointment, people don't write proper summaries and, as such, summaries are not useful to be considered a "short review" on their own right. This necessitates splitting the reviews onto different pages.
-rw-r--r--data/style.css9
-rw-r--r--elm/Reviews/Edit.elm38
-rw-r--r--lib/VNDB/BBCode.pm14
-rw-r--r--lib/VNDB/Handler/Misc.pm2
-rw-r--r--lib/VNWeb/Discussions/UPosts.pm2
-rw-r--r--lib/VNWeb/Misc/History.pm2
-rw-r--r--lib/VNWeb/Reviews/Edit.pm6
-rw-r--r--lib/VNWeb/Reviews/List.pm24
-rw-r--r--lib/VNWeb/Reviews/Page.pm12
-rw-r--r--lib/VNWeb/Reviews/VNTab.pm23
-rw-r--r--lib/VNWeb/VN/Page.pm7
-rw-r--r--sql/schema.sql4
-rw-r--r--util/updates/2020-08-24-reviews-nosummary.sql6
13 files changed, 72 insertions, 77 deletions
diff --git a/data/style.css b/data/style.css
index 1fc5c431..cd743aa0 100644
--- a/data/style.css
+++ b/data/style.css
@@ -629,10 +629,11 @@ div.producerbrowse { padding-bottom: 10px }
.reviewlist td.tc1 { width: 90px }
.reviewlist td.tc2 { width: 110px; }
-.reviewlist td.tc4 { width: 50px; text-align: right }
-.reviewlist td.tc5 { width: 80px; padding-left: 15px }
-.reviewlist td.tc6 { width: 30px; text-align: right }
-.reviewlist td.tc7 { width: 250px; text-align: right }
+.reviewlist td.tc3 { width: 50px; text-align: right }
+.reviewlist td.tc4 { width: 50px }
+.reviewlist td.tc6 { width: 80px }
+.reviewlist td.tc7 { width: 30px; text-align: right }
+.reviewlist td.tc8 { width: 250px; text-align: right }
/***** Release browser *****/
diff --git a/elm/Reviews/Edit.elm b/elm/Reviews/Edit.elm
index ae010f1f..1b25ad54 100644
--- a/elm/Reviews/Edit.elm
+++ b/elm/Reviews/Edit.elm
@@ -32,8 +32,7 @@ type alias Model =
, vntitle : String
, rid : Maybe Int
, spoiler : Bool
- , full : Bool
- , summary : TP.Model
+ , isfull : Bool
, text : TP.Model
, releases : List GRE.RecvReleases
, delete : Bool
@@ -49,8 +48,7 @@ init d =
, vntitle = d.vntitle
, rid = d.rid
, spoiler = d.spoiler
- , full = d.text /= ""
- , summary = TP.bbcode d.summary
+ , isfull = d.isfull
, text = TP.bbcode d.text
, releases = d.releases
, delete = False
@@ -64,8 +62,8 @@ encode m =
, vid = m.vid
, rid = m.rid
, spoiler = m.spoiler
- , summary = m.summary.data
- , text = if m.full then m.text.data else ""
+ , isfull = m.isfull
+ , text = m.text.data
}
@@ -73,7 +71,6 @@ type Msg
= Release (Maybe Int)
| Full Bool
| Spoiler Bool
- | Summary TP.Msg
| Text TP.Msg
| Submit
| Submitted GApi.Response
@@ -86,10 +83,9 @@ update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
case msg of
Release i -> ({ model | rid = i }, Cmd.none)
- Full b -> ({ model | full = b }, Cmd.none)
+ Full b -> ({ model | isfull = b }, Cmd.none)
Spoiler b -> ({ model | spoiler = b }, Cmd.none)
- Summary m -> let (nm,nc) = TP.update m model.summary in ({ model | summary = nm }, Cmd.map Summary nc)
- Text m -> let (nm,nc) = TP.update m model.text in ({ model | text = nm }, Cmd.map Text nc)
+ Text m -> let (nm,nc) = TP.update m model.text in ({ model | text = nm }, Cmd.map Text nc)
Submit -> ({ model | state = Api.Loading }, GRE.send (encode model) Submitted)
Submitted (GApi.Redirect s) -> (model, load s)
@@ -120,14 +116,11 @@ view model =
]
, tr [ class "newpart" ] [ td [ colspan 2 ] [ text "" ] ]
, formField "Review type"
- [ label [] [ inputRadio "type" (model.full == False) (\_ -> Full False), b [] [ text " Short review" ]
+ [ label [] [ inputRadio "type" (model.isfull == False) (\_ -> Full False), b [] [ text " Mini review" ]
, text <| " - Recommendation-style, maximum " ++ String.fromInt maxChars ++ " characters." ]
, br [] []
- , label [] [ inputRadio "type" (model.full == True ) (\_ -> Full True ), b [] [ text " Full review" ]
+ , label [] [ inputRadio "type" (model.isfull == True ) (\_ -> Full True ), b [] [ text " Full review" ]
, text " - Longer, more detailed." ]
- , if not model.full && model.text.data /= ""
- then span [] [ br [] [], b [ class "standout" ] [ text "Warning: " ], text "existing content from the \"Full review\" mode will be lost when saving this form." ]
- else text ""
, br [] []
, b [ class "grayedout" ] [ text "You can always switch between review types later." ]
]
@@ -138,26 +131,21 @@ view model =
, b [ class "grayedout" ] [ text "You do not have to check this option if all spoilers in your review are marked with [spoiler] tags." ]
]
, tr [ class "newpart" ] [ td [ colspan 2 ] [ text "" ] ]
- , formField (if model.full then "sum::Summary" else "sum::Review")
- [ TP.view "sum" model.summary Summary 700 ([rows 5, cols 50] ++ GRE.valSummary)
+ , formField "text::Review"
+ [ TP.view "sum" model.text Text 700 ([rows (if model.isfull then 15 else 5), cols 50] ++ GRE.valText)
[ a [ href "/d9#3" ] [ text "BBCode formatting supported" ] ]
- , div [ style "width" "700px", style "text-align" "right" ]
+ , if model.isfull then text "" else div [ style "width" "700px", style "text-align" "right" ]
[ let
- len = String.length model.summary.data
+ len = String.length model.text.data
lbl = String.fromInt len ++ "/" ++ String.fromInt maxChars
in if len > maxChars then b [ class "standout" ] [ text lbl ] else text lbl
]
]
- , if not model.full then text "" else
- formField "text::Full review"
- [ TP.view "text" model.text Text 700 ([rows 15, cols 50, required True] ++ GRE.valText)
- [ a [ href "/d9#3" ] [ text "BBCode formatting supported" ] ]
- ]
]
]
, div [ class "mainbox" ]
[ fieldset [ class "submit" ]
- [ submitButton "Submit" model.state (String.length model.summary.data <= maxChars)
+ [ submitButton "Submit" model.state (model.isfull || String.length model.text.data <= maxChars)
]
]
, if model.id == Nothing then text "" else
diff --git a/lib/VNDB/BBCode.pm b/lib/VNDB/BBCode.pm
index f6ab93d9..fe3a43d7 100644
--- a/lib/VNDB/BBCode.pm
+++ b/lib/VNDB/BBCode.pm
@@ -179,7 +179,7 @@ FINAL:
# 2: Just output 'hidden by spoiler setting' message
# 3: Just output the spoilers, unmarked
sub bb2html {
- my($input, $maxlength, $charspoil) = @_;
+ my($input, $maxlength, $charspoil, $nobreak) = @_;
my $incode = 0;
my $rmnewline = 0;
@@ -202,8 +202,8 @@ sub bb2html {
s/&/&amp;/g;
s/>/&gt;/g;
s/</&lt;/g;
- s/\n/<br>/g if !$maxlength;
- s/\n/ /g if $maxlength;
+ s/\n/<br>/g if !$nobreak;
+ s/\n/ /g if $nobreak;
$_;
};
@@ -233,18 +233,18 @@ sub bb2html {
$charspoil == 2 ? '-->' : '';
} elsif($tag eq 'quote_start') {
- $ret .= '<div class="quote">' if !$maxlength;
+ $ret .= '<div class="quote">' if !$nobreak;
$rmnewline = 1;
} elsif($tag eq 'quote_end') {
- $ret .= '</div>' if !$maxlength;
+ $ret .= '</div>' if !$nobreak;
$rmnewline = 1;
} elsif($tag eq 'code_start') {
- $ret .= '<pre>' if !$maxlength;
+ $ret .= '<pre>' if !$nobreak;
$rmnewline = 1;
$incode = 1;
} elsif($tag eq 'code_end') {
- $ret .= '</pre>' if !$maxlength;
+ $ret .= '</pre>' if !$nobreak;
$rmnewline = 1;
$incode = 0;
diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm
index c316999d..b4827da2 100644
--- a/lib/VNDB/Handler/Misc.pm
+++ b/lib/VNDB/Handler/Misc.pm
@@ -105,7 +105,7 @@ sub homepage {
a href => "/$_->{id}", $_->{title};
end;
p;
- lit bb2html $post->{msg}, 150;
+ lit bb2html $post->{msg}, 150, 0, 1;
end;
}
end 'td';
diff --git a/lib/VNWeb/Discussions/UPosts.pm b/lib/VNWeb/Discussions/UPosts.pm
index 0a0165d0..46bb0977 100644
--- a/lib/VNWeb/Discussions/UPosts.pm
+++ b/lib/VNWeb/Discussions/UPosts.pm
@@ -24,7 +24,7 @@ sub listing_ {
td_ class => 'tc3', fmtdate $_->{date};
td_ class => 'tc4', sub {
a_ href => $url, $_->{title};
- b_ class => 'grayedout', sub { lit_ bb2html $_->{msg}, 150 };
+ b_ class => 'grayedout', sub { lit_ bb2html $_->{msg}, 150, 0, 1 };
};
} for @$list;
}
diff --git a/lib/VNWeb/Misc/History.pm b/lib/VNWeb/Misc/History.pm
index 7ce5584f..0959eb91 100644
--- a/lib/VNWeb/Misc/History.pm
+++ b/lib/VNWeb/Misc/History.pm
@@ -80,7 +80,7 @@ sub tablebox_ {
td_ class => 'tc3', sub { user_ $i };
td_ class => 'tc4', sub {
a_ href => $revurl, title => $i->{original}, shorten $i->{title}, 80;
- b_ class => 'grayedout', sub { lit_ bb2html $i->{comments}, 150 };
+ b_ class => 'grayedout', sub { lit_ bb2html $i->{comments}, 150, 0, 1 };
};
} for @$lst;
};
diff --git a/lib/VNWeb/Reviews/Edit.pm b/lib/VNWeb/Reviews/Edit.pm
index fc1e1964..f32b6b8d 100644
--- a/lib/VNWeb/Reviews/Edit.pm
+++ b/lib/VNWeb/Reviews/Edit.pm
@@ -10,7 +10,7 @@ my $FORM = {
vntitle => { _when => 'out' },
rid => { id => 1, required => 0 },
spoiler => { anybool => 1 },
- summary => { maxlength => 700 },
+ isfull => { anybool => 1 },
text => { maxlength => 100_000, required => 0, default => '' },
releases => { _when => 'out', $VNWeb::Elm::apis{Releases}[0]->%* },
@@ -36,7 +36,7 @@ TUWF::get qr{/$RE{vid}/addreview}, sub {
TUWF::get qr{/$RE{wid}/edit}, sub {
my $e = tuwf->dbRowi(
- 'SELECT r.id, r.uid AS user_id, r.vid, r.rid, r.summary, r.text, r.spoiler, v.title AS vntitle
+ 'SELECT r.id, r.uid AS user_id, r.vid, r.rid, r.isfull, r.text, r.spoiler, v.title AS vntitle
FROM reviews r JOIN vn v ON v.id = r.vid WHERE r.id =', \tuwf->capture('id')
);
return tuwf->resNotFound if !$e->{id};
@@ -60,7 +60,7 @@ elm_api ReviewsEdit => $FORM_OUT, $FORM_IN, sub {
validate_dbid 'SELECT id FROM vn WHERE id IN', $data->{vid};
validate_dbid 'SELECT id FROM releases WHERE id IN', $data->{rid} if defined $data->{rid};
- $data->{summary} = bb_subst_links $data->{summary};
+ die "Review too long" if !$data->{isfull} && length $data->{text} > 700;
$data->{text} = bb_subst_links $data->{text};
if($id) {
diff --git a/lib/VNWeb/Reviews/List.pm b/lib/VNWeb/Reviews/List.pm
index 04f932bd..5ab5a133 100644
--- a/lib/VNWeb/Reviews/List.pm
+++ b/lib/VNWeb/Reviews/List.pm
@@ -15,20 +15,22 @@ sub tablebox_ {
thead_ sub { tr_ sub {
td_ class => 'tc1', sub { txt_ 'Date'; sortable_ 'id', $opt, \&url };
td_ class => 'tc2', 'By';
- td_ class => 'tc3', 'Review';
- td_ class => 'tc4', 'Vote';
- td_ class => 'tc5', sub { txt_ 'Score'; sortable_ 'rating', $opt, \&url if auth->isMod };
- td_ class => 'tc6', 'C#';
- td_ class => 'tc7', sub { txt_ 'Last comment'; sortable_ 'lastpost', $opt, \&url };
+ td_ class => 'tc3', 'Vote';
+ td_ class => 'tc4', 'Type';
+ td_ class => 'tc5', 'Review';
+ td_ class => 'tc6', sub { txt_ 'Score'; sortable_ 'rating', $opt, \&url if auth->isMod };
+ td_ class => 'tc7', 'C#';
+ td_ class => 'tc8', sub { txt_ 'Last comment'; sortable_ 'lastpost', $opt, \&url };
} };
tr_ sub {
td_ class => 'tc1', fmtdate $_->{date}, 'compact';
td_ class => 'tc2', sub { user_ $_ };
- td_ class => 'tc3', sub { a_ href => "/$_->{id}", $_->{title} };
- td_ class => 'tc4', fmtvote $_->{vote};
- td_ class => 'tc5', sub { review_vote_ $_ };
- td_ class => 'tc6', $_->{c_count};
- td_ class => 'tc7', $_->{c_lastnum} ? sub {
+ td_ class => 'tc3', fmtvote $_->{vote};
+ td_ class => 'tc4', $_->{isfull} ? 'Full' : 'Mini';
+ td_ class => 'tc5', sub { a_ href => "/$_->{id}", $_->{title} };
+ td_ class => 'tc6', sub { review_vote_ $_ };
+ td_ class => 'tc7', $_->{c_count};
+ td_ class => 'tc8', $_->{c_lastnum} ? sub {
user_ $_, 'lu_';
txt_ ' @ ';
a_ href => "/$_->{id}.$_->{c_lastnum}#last", fmtdate $_->{ldate}, 'full';
@@ -55,7 +57,7 @@ TUWF::get qr{/w}, sub {
my $count = tuwf->dbVali('SELECT COUNT(*) FROM reviews');
my $lst = tuwf->dbPagei({results => 50, page => $opt->{p}}, '
- SELECT w.id, w.vid, w.c_up, w.c_down, w.c_count, w.c_lastnum, v.title, uv.vote
+ SELECT w.id, w.vid, w.isfull, w.c_up, w.c_down, w.c_count, w.c_lastnum, v.title, uv.vote
, ', sql_user(), ',', sql_totime('w.date'), 'as date
, ', sql_user('wpu','lu_'), ',', sql_totime('wp.date'), 'as ldate
FROM reviews w
diff --git a/lib/VNWeb/Reviews/Page.pm b/lib/VNWeb/Reviews/Page.pm
index 23c62cf1..4a8d6b6b 100644
--- a/lib/VNWeb/Reviews/Page.pm
+++ b/lib/VNWeb/Reviews/Page.pm
@@ -56,13 +56,9 @@ sub review_ {
};
} if $w->{spoiler};
tr_ @spoil, sub {
- td_ length $w->{text} ? 'Summary' : 'Review';
- td_ sub { lit_ bb2html $w->{summary} }
- };
- tr_ @spoil, sub {
- td_ 'Full review';
+ td_ 'Review';
td_ sub { lit_ bb2html $w->{text} }
- } if length $w->{text};
+ };
tr_ sub {
td_ '';
td_ style => 'text-align: right', sub { review_vote_ $w };
@@ -75,7 +71,7 @@ TUWF::get qr{/$RE{wid}(?:(?<sep>[\./])$RE{num})?}, sub {
return tuwf->resNotFound if !auth->permReview; #XXX:While in beta
my($id, $sep, $num) = (tuwf->capture('id'), tuwf->capture('sep')||'', tuwf->capture('num'));
my $w = tuwf->dbRowi(
- 'SELECT r.id, r.vid, r.rid, r.summary, r.text, r.spoiler, COALESCE(c.count,0) AS count, r.c_up, r.c_down, uv.vote, r2.id IS NULL AS can
+ 'SELECT r.id, r.vid, r.rid, r.isfull, r.text, r.spoiler, COALESCE(c.count,0) AS count, r.c_up, r.c_down, uv.vote, r2.id IS NULL AS can
, rel.title AS rtitle, rel.original AS roriginal, rel.type AS rtype, rv.vote AS my
, ', sql_user(), ',', sql_totime('r.date'), 'AS date,', sql_totime('r.lastmod'), 'AS lastmod
FROM reviews r
@@ -114,7 +110,7 @@ TUWF::get qr{/$RE{wid}(?:(?<sep>[\./])$RE{num})?}, sub {
pagevars => {sethash=>$num?$num:$page>1?'threadstart':'review'},
sub {
VNWeb::VN::Page::infobox_($v);
- VNWeb::VN::Page::tabs_($v, 'reviews');
+ VNWeb::VN::Page::tabs_($v, $w->{isfull}?'reviews':'minireviews');
div_ class => 'mainbox', id => 'review', sub {
p_ class => 'mainopts', sub {
if(can_edit w => $w) {
diff --git a/lib/VNWeb/Reviews/VNTab.pm b/lib/VNWeb/Reviews/VNTab.pm
index c2a6dee6..0201c75c 100644
--- a/lib/VNWeb/Reviews/VNTab.pm
+++ b/lib/VNWeb/Reviews/VNTab.pm
@@ -5,24 +5,24 @@ use VNWeb::Reviews::Lib;
sub reviews_ {
- my($v) = @_;
+ my($v, $mini) = @_;
- # TODO: Filters for upvote threshold, isfull and maybe vote
+ # TODO: Filters for upvote threshold
# TODO: Order
my $lst = tuwf->dbAlli(
- 'SELECT r.id, r.rid, r.summary, r.text <> \'\' AS isfull, r.spoiler, r.c_up, r.c_down, r.c_count, uv.vote, rv.vote AS my, r2.id IS NULL AS can
+ 'SELECT r.id, r.rid, r.text, r.spoiler, r.c_up, r.c_down, r.c_count, uv.vote, rv.vote AS my, NOT r.isfull AND r2.id IS NULL AS can
, ', sql_totime('r.date'), 'AS date, ', sql_user(), '
FROM reviews r
LEFT JOIN users u ON r.uid = u.id
LEFT JOIN ulist_vns uv ON uv.uid = r.uid AND uv.vid = r.vid
LEFT JOIN reviews_votes rv ON rv.uid =', \auth->uid, ' AND rv.id = r.id
LEFT JOIN reviews r2 ON r2.vid = r.vid AND r2.uid =', \auth->uid, '
- WhERE r.vid =', \$v->{id}
+ WhERE r.vid =', \$v->{id}, 'AND', ($mini ? 'NOT' : ''), 'r.isfull'
);
div_ class => 'mainbox', sub {
- h1_ 'Reviews';
+ h1_ $mini ? 'Mini reviews' : 'Reviews';
debug_ $lst;
div_ class => 'reviews', sub {
article_ class => 'reviewbox', sub {
@@ -45,11 +45,11 @@ sub reviews_ {
if($r->{spoiler}) {
label_ class => 'review_spoil', sub {
input_ type => 'checkbox', class => 'visuallyhidden', (auth->pref('spoilers')||0) == 2 ? ('checked', 'checked') : (), undef;
- div_ sub { lit_ bb2html $r->{summary} };
+ div_ sub { lit_ bb2html $r->{text}, 700 };
span_ class => 'fake_link', 'This review contains spoilers, click to view.';
}
} else {
- lit_ bb2html $r->{summary};
+ lit_ bb2html $r->{text}, 700;
}
};
div_ sub {
@@ -63,17 +63,18 @@ sub reviews_ {
}
-TUWF::get qr{/$RE{vid}/reviews}, sub {
+TUWF::get qr{/$RE{vid}/(?<mini>mini)?reviews}, sub {
return tuwf->resNotFound if !auth->permReview; #XXX:While in beta
+ my $mini = !!tuwf->capture('mini');
my $v = db_entry v => tuwf->capture('id');
return tuwf->resNotFound if !$v;
VNWeb::VN::Page::enrich_vn($v);
- framework_ title => "Reviews for $v->{title}", index => 1, type => 'v', dbobj => $v, hiddenmsg => 1,
+ framework_ title => ($mini?'Mini reviews':'Reviews')." for $v->{title}", index => 1, type => 'v', dbobj => $v, hiddenmsg => 1,
sub {
VNWeb::VN::Page::infobox_($v);
- VNWeb::VN::Page::tabs_($v, 'reviews');
- reviews_ $v;
+ VNWeb::VN::Page::tabs_($v, ($mini?'minireviews':'reviews'));
+ reviews_ $v, $mini;
};
};
diff --git a/lib/VNWeb/VN/Page.pm b/lib/VNWeb/VN/Page.pm
index 5f24296a..3e48437d 100644
--- a/lib/VNWeb/VN/Page.pm
+++ b/lib/VNWeb/VN/Page.pm
@@ -387,15 +387,16 @@ sub infobox_ {
sub tabs_ {
my($v, $tab) = @_;
my $chars = tuwf->dbVali('SELECT COUNT(DISTINCT c.id) FROM chars c JOIN chars_vns cv ON cv.id = c.id WHERE NOT c.hidden AND cv.vid =', \$v->{id});
- my $reviews = auth->permReview ? tuwf->dbVali('SELECT COUNT(*) FROM reviews WHERE vid =', \$v->{id}) : 0;
+ my $reviews = auth->permReview ? tuwf->dbRowi('SELECT COUNT(*) FILTER(WHERE isfull) AS full, COUNT(*) FILTER(WHERE NOT isfull) AS mini FROM reviews WHERE vid =', \$v->{id}) : {};
- return if !$chars && !$reviews && !auth->permEdit && !auth->permReview;
+ return if !$chars && !$reviews->{full} && !$reviews->{mini} && !auth->permEdit && !auth->permReview;
$tab ||= '';
div_ class => 'maintabs', sub {
ul_ sub {
li_ class => ($tab eq '' ? ' tabselected' : ''), sub { a_ href => "/v$v->{id}#main", name => 'main', 'main' } if $chars || $reviews;
li_ class => ($tab eq 'chars' ? ' tabselected' : ''), sub { a_ href => "/v$v->{id}/chars#chars", name => 'chars', "characters ($chars)" } if $chars;
- li_ class => ($tab eq 'reviews' ? ' tabselected' : ''), sub { a_ href => "/v$v->{id}/reviews#review", name => 'review', "reviews ($reviews)" } if $reviews;
+ li_ class => ($tab eq 'minireviews'?' tabselected':''), sub { a_ href => "/v$v->{id}/minireviews#review", name => 'review', "mini reviews ($reviews->{mini})" } if $reviews->{mini};
+ li_ class => ($tab eq 'reviews' ? ' tabselected' : ''), sub { a_ href => "/v$v->{id}/reviews#review", name => 'review', "full reviews ($reviews->{full})" } if $reviews->{full};
};
ul_ sub {
if(auth && canvote $v) {
diff --git a/sql/schema.sql b/sql/schema.sql
index cbcca38f..b195cacb 100644
--- a/sql/schema.sql
+++ b/sql/schema.sql
@@ -506,13 +506,13 @@ CREATE TABLE reviews (
rid int,
date timestamptz NOT NULL DEFAULT NOW(),
lastmod timestamptz,
- summary text NOT NULL,
text text,
spoiler boolean NOT NULL,
c_up int NOT NULL DEFAULT 0,
c_down int NOT NULL DEFAULT 0,
c_count smallint NOT NULL DEFAULT 0,
- c_lastnum smallint
+ c_lastnum smallint,
+ isfull boolean NOT NULL
);
-- reviews_posts
diff --git a/util/updates/2020-08-24-reviews-nosummary.sql b/util/updates/2020-08-24-reviews-nosummary.sql
new file mode 100644
index 00000000..7333a2fc
--- /dev/null
+++ b/util/updates/2020-08-24-reviews-nosummary.sql
@@ -0,0 +1,6 @@
+ALTER TABLE reviews ADD COLUMN isfull boolean NOT NULL DEFAULT false;
+UPDATE reviews SET isfull = text <> '';
+UPDATE reviews SET text = summary WHERE NOT isfull;
+UPDATE reviews SET text = summary || text WHERE isfull;
+ALTER TABLE reviews ALTER COLUMN isfull DROP DEFAULT;
+ALTER TABLE reviews DROP COLUMN summary;