HTML and JSON for threads are no longer built when using an SQLite3 database #212

Closed
opened 2021-05-07 10:57:36 +00:00 by ChristopherCormier · 6 comments

Super weird issue. The board index builds fine, but it only contains thread OPs and no replies. In the management panel, all threads and replies appear normally and behave properly. But, even after clicking "Rebuild all", nothing is created in the /res/ folder.

Strangely, in extended testing, I've had a few instances where it appears to correctly build these files for one or two random threads? If I proceed to reply to one, that reply is entered into the database and shows up in the management panel, but that thread's HTML isn't rebuilt to make the reply visible. The specifics of the issue are difficult to pin down.

I'm guessing this was introduced in the "Add TINYIB_AUTOHIDE" commit, just because that was the most recent one to touch the database code. After reverting past that commit on my local instance, I'm able to properly rebuild the board again.

Super weird issue. The board index builds fine, but it only contains thread OPs and no replies. In the management panel, all threads and replies appear normally and behave properly. But, even after clicking "Rebuild all", nothing is created in the /res/ folder. Strangely, in extended testing, I've had a few instances where it appears to correctly build these files for one or two random threads? If I proceed to reply to one, that reply is entered into the database and shows up in the management panel, but that thread's HTML isn't rebuilt to make the reply visible. The specifics of the issue are difficult to pin down. I'm guessing this was introduced in the "Add TINYIB_AUTOHIDE" commit, just because that was the most recent one to touch the database code. After reverting past that commit on my local instance, I'm able to properly rebuild the board again.

Thanks for reporting this. Please let me know if the recent commit and its instructions resolve this.

Thanks for reporting this. Please let me know if the recent commit and its instructions resolve this.

Anyone affected by this issue may need to run the following query, replacing TINYIB_DBPOSTS with its value in settings.php:

ALTER TABLE TINYIB_DBPOSTS CHANGE COLUMN moderated INTEGER NOT NULL DEFAULT '1'
Anyone affected by this issue may need to run the following query, replacing `TINYIB_DBPOSTS` with its value in settings.php: ```sql ALTER TABLE TINYIB_DBPOSTS CHANGE COLUMN moderated INTEGER NOT NULL DEFAULT '1' ```

Thanks! I've found out that SQLite only supports a subset of ALTER TABLE functionality, and a column cannot be changed with it. Is there an equivalent query I could use?

Thanks! I've found out that SQLite only supports a subset of ALTER TABLE functionality, and a column cannot be changed with it. Is there an equivalent query I could use?

SQLite users:

Back up your database, then run the following query, replacing TINYIB_DBPOSTS with your posts table name:

BEGIN TRANSACTION;

CREATE TABLE posts_temp (
  id INTEGER PRIMARY KEY,
  parent INTEGER NOT NULL,
  timestamp TIMESTAMP NOT NULL,
  bumped TIMESTAMP NOT NULL,
  ip TEXT NOT NULL,
  name TEXT NOT NULL,
  tripcode TEXT NOT NULL,
  email TEXT NOT NULL,
  nameblock TEXT NOT NULL,
  subject TEXT NOT NULL,
  message TEXT NOT NULL,
  password TEXT NOT NULL,
  file TEXT NOT NULL,
  file_hex TEXT NOT NULL,
  file_original TEXT NOT NULL,
  file_size INTEGER NOT NULL DEFAULT '0',
  file_size_formatted TEXT NOT NULL,
  image_width INTEGER NOT NULL DEFAULT '0',
  image_height INTEGER NOT NULL DEFAULT '0',
  thumb TEXT NOT NULL,
  thumb_width INTEGER NOT NULL DEFAULT '0',
  thumb_height INTEGER NOT NULL DEFAULT '0',
  moderated INTEGER NOT NULL DEFAULT '1',
  stickied INTEGER NOT NULL DEFAULT '0',
  locked INTEGER NOT NULL DEFAULT '0'
);

INSERT INTO posts_temp SELECT * FROM TINYIB_DBPOSTS;

DROP TABLE TINYIB_DBPOSTS;

CREATE TABLE TINYIB_DBPOSTS (
  id INTEGER PRIMARY KEY,
  parent INTEGER NOT NULL,
  timestamp TIMESTAMP NOT NULL,
  bumped TIMESTAMP NOT NULL,
  ip TEXT NOT NULL,
  name TEXT NOT NULL,
  tripcode TEXT NOT NULL,
  email TEXT NOT NULL,
  nameblock TEXT NOT NULL,
  subject TEXT NOT NULL,
  message TEXT NOT NULL,
  password TEXT NOT NULL,
  file TEXT NOT NULL,
  file_hex TEXT NOT NULL,
  file_original TEXT NOT NULL,
  file_size INTEGER NOT NULL DEFAULT '0',
  file_size_formatted TEXT NOT NULL,
  image_width INTEGER NOT NULL DEFAULT '0',
  image_height INTEGER NOT NULL DEFAULT '0',
  thumb TEXT NOT NULL,
  thumb_width INTEGER NOT NULL DEFAULT '0',
  thumb_height INTEGER NOT NULL DEFAULT '0',
  moderated INTEGER NOT NULL DEFAULT '1',
  stickied INTEGER NOT NULL DEFAULT '0',
  locked INTEGER NOT NULL DEFAULT '0'
);

INSERT INTO TINYIB_DBPOSTS SELECT * FROM posts_temp;

DROP TABLE posts_temp;

COMMIT;
**SQLite users:** Back up your database, then run the following query, replacing `TINYIB_DBPOSTS` with your posts table name: ```sql BEGIN TRANSACTION; CREATE TABLE posts_temp ( id INTEGER PRIMARY KEY, parent INTEGER NOT NULL, timestamp TIMESTAMP NOT NULL, bumped TIMESTAMP NOT NULL, ip TEXT NOT NULL, name TEXT NOT NULL, tripcode TEXT NOT NULL, email TEXT NOT NULL, nameblock TEXT NOT NULL, subject TEXT NOT NULL, message TEXT NOT NULL, password TEXT NOT NULL, file TEXT NOT NULL, file_hex TEXT NOT NULL, file_original TEXT NOT NULL, file_size INTEGER NOT NULL DEFAULT '0', file_size_formatted TEXT NOT NULL, image_width INTEGER NOT NULL DEFAULT '0', image_height INTEGER NOT NULL DEFAULT '0', thumb TEXT NOT NULL, thumb_width INTEGER NOT NULL DEFAULT '0', thumb_height INTEGER NOT NULL DEFAULT '0', moderated INTEGER NOT NULL DEFAULT '1', stickied INTEGER NOT NULL DEFAULT '0', locked INTEGER NOT NULL DEFAULT '0' ); INSERT INTO posts_temp SELECT * FROM TINYIB_DBPOSTS; DROP TABLE TINYIB_DBPOSTS; CREATE TABLE TINYIB_DBPOSTS ( id INTEGER PRIMARY KEY, parent INTEGER NOT NULL, timestamp TIMESTAMP NOT NULL, bumped TIMESTAMP NOT NULL, ip TEXT NOT NULL, name TEXT NOT NULL, tripcode TEXT NOT NULL, email TEXT NOT NULL, nameblock TEXT NOT NULL, subject TEXT NOT NULL, message TEXT NOT NULL, password TEXT NOT NULL, file TEXT NOT NULL, file_hex TEXT NOT NULL, file_original TEXT NOT NULL, file_size INTEGER NOT NULL DEFAULT '0', file_size_formatted TEXT NOT NULL, image_width INTEGER NOT NULL DEFAULT '0', image_height INTEGER NOT NULL DEFAULT '0', thumb TEXT NOT NULL, thumb_width INTEGER NOT NULL DEFAULT '0', thumb_height INTEGER NOT NULL DEFAULT '0', moderated INTEGER NOT NULL DEFAULT '1', stickied INTEGER NOT NULL DEFAULT '0', locked INTEGER NOT NULL DEFAULT '0' ); INSERT INTO TINYIB_DBPOSTS SELECT * FROM posts_temp; DROP TABLE posts_temp; COMMIT; ```

You can run the above query via the SQLite3 CLI:

sqlite3 tinyib.db
You can run the above query via the SQLite3 CLI: ```shell sqlite3 tinyib.db ```

Fantastic, everything seems to be resolved and a rebuild works as expected now. Thanks for the timely response.

Fantastic, everything seems to be resolved and a rebuild works as expected now. Thanks for the timely response.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tslocum/tinyib#212
There is no content yet.