Apparently no maximum size for drafts
-
Continuing from http://what.thedailywtf.com/t/hobbit-code-hidden-bonus-content-pour-encourager-les-autres/47808 :
@PJH, can you sort drafts by size? Because I apparently managed to make one of the whole unabridged copy of War and Peace in that thread, courtesy of Project Gutenberg.
-
discourse=# select username, char_length(data) from drafts d join users u on u.id=d.user_id order by char_length(data) desc limit 10; username | char_length -------------+------------- Maciejasjmj | 3309702 Zecc | 354621 mott555 | 58835 ben_lubar | 55568 delfinom | 50586 riking | 40085 ben_lubar | 38713 sam | 37888 SpoofedEx | 32709 ben_lubar | 32252 (10 rows)
-
I'm in the top ten THREE times?
-
I'm in the top ten THREE times?
-
Topic IDs should have been included so people can go to the right topic to cancel the draft I think ;)
If they want to, that is
-
I haven't found how the
draft
table links elsewhere yet.Even if, given my other post, they can be deleted.
-
discourse=# select username, d.id, draft_key, char_length(data) from drafts d join users u on u.id=d.user_id order by char_length(data) desc limit 25; username | id | draft_key | char_length -----------------+-------+-------------+------------- Maciejasjmj | 85592 | topic_47808 | 3309702 Zecc | 84229 | topic_47682 | 354621 mott555 | 50701 | topic_5566 | 58835 ben_lubar | 64042 | topic_7707 | 55568 delfinom | 16332 | topic_2030 | 50586 riking | 74294 | topic_9008 | 40085 ben_lubar | 16858 | topic_2077 | 38713 sam | 66436 | topic_8119 | 37888 SpoofedEx | 16971 | topic_2077 | 32709 ben_lubar | 16352 | topic_2014 | 32252 Zecc | 45748 | topic_4822 | 32235 mott555 | 1149 | topic_370 | 30496 oesor | 1116 | topic_370 | 30400 ben_lubar | 74292 | topic_9008 | 30318 JazzyJosh | 28224 | topic_3322 | 29755 boomzilla | 26743 | topic_3197 | 28518 Matches | 26589 | topic_3197 | 28487 RaceProUK | 48052 | topic_5303 | 20446 anotherusername | 23552 | topic_2865 | 19685 HardwareGeek | 70793 | topic_3866 | 13644 abarker | 88914 | topic_3866 | 13644 Yamikuronue | 76196 | topic_917 | 13309 nightware | 84466 | topic_3866 | 13138 jkshapiro | 69141 | topic_917 | 13120 sloosecannon | 84061 | topic_3866 | 13117 (25 rows)
-
I have a 20kB draft in topic 5303?
Edit: Well, it doesn't load when I load the topic…
-
ben_lubar | 64042 | topic_7707 | 55568
I don't see anything when I load that topic.
Is there a deleted_at field on the table? I wonder if it would break anything to remove the drafts with non-NULL deleted_at.
-
I haven't found how the draft table links elsewhere yet.
Even if, given my other post, they can be deleted.
I think it uses sequence numbers or something like that. Would investigate, but it's Sunday and Steam just updated, so...
-
Is there a deleted_at field on the table? I wonder if it would break anything to remove the drafts with non-NULL deleted_at.
No.
discourse=# \d drafts Table "public.drafts" Column | Type | Modifiers ------------+-----------------------------+----------------------------------------------------- id | integer | not null default nextval('drafts_id_seq'::regclass) user_id | integer | not null draft_key | character varying(255) | not null data | text | not null created_at | timestamp without time zone | not null updated_at | timestamp without time zone | not null sequence | integer | not null default 0 Indexes: "drafts_pkey" PRIMARY KEY, btree (id) "index_drafts_on_user_id_and_draft_key" btree (user_id, draft_key) discourse=#
And I can't see how that table actually relates to the other tables yet.
-
draft_key
? Using the highly effectivevarchar
method to link to topic ID?And yes, I understand why they did it that way. It's probably
post_<id>
for pending edits and such. I'd say they should have usedJSON
, orhstore
or something else indexable, but they have a MySQL backend as well, don't they?Maybe run a query with
draft_key LIKE 'post_%'
to test that hypothesis?
-
Maybe run a query with draft_key LIKE 'post_%' to test that hypothesis?
postgres@what:/$ psql -d discourse -c "select draft_key from drafts where draft_key ilike 'post%' limit 10" draft_key ----------- (0 rows)
It appears to be either
topic_###
,createTopic
,new_topic
,reply_as_new_topic
ornew_private_message
-
Huh. Wonder how it deals with edits then. I'm pretty sure you can leave an edit in a draft. Or I'm misremembering something.
EDIT: Well, it survived closing the tab and a full refresh. Huh.
-
There'll be a FK into
drafts
somewhere - I just haven't found it.
-
There'll be a FK into drafts somewhere - I just haven't found it.
Somewhere in the ORM you mean? Because I didn't see a single FK in the DB export I got from @accalia (I think that one was from @riking's test instance?).
Unless something went wrong with the dump, that is.
-
It's probably some bastard spawn of
draft_key
andsequence
. Normally, given the rest of the DB, I'd expectdraft_id
to make an appearance somewhere, but as you've found out, there isn't one.
-
-
Oh, yes, that's not confusing at all when used in conjunction with Postgres which uses a thing called
sequence
already...
-
What did you expect them to do, use existing functionality for its intended purpose? That's not part of the Discourse 10-year plan.
-
That's not part of the Discourse 10-year plan.
There's a plan?! I'm pretty sure it's all just adhoc stuff that comes out of Jeff's bikeshed.
-
-
That's not part of the Discourse 10-year plan.
Niemand hat die Absicht, Barrieren zu errichten ...
Filed under:LiesDiscotruths
-
Weren't we going with "Rate-limit all the things!"?
-
Rate limits make you free.
-
Repeat after me: Think for yourself, question authority, think for yourself, question authority.
-
you can't tell me what to think or say!
:-P
-
Why do you think that's such a good idea?
-
Why do you think it's necessary to ask that question?
-
Color me surprised: I remember the non-conformists oath "Repeat after me, think for yourself. Question authority. Strive to be different. Strive to be unique. And never repeat things that other people say." (Goal is to have an audience repeat your sentences). From some Tool bootleg but it appears to be an original Steve Martin joke. Not that I thought it was an MJK original but I didn't think Steve Martin actually had a funny joke to tell.
-
-
I remember the non-conformists oath
Life Of Brian (1979) - clip: "You're all individuals" – 00:44
— anyolite