Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(tgdb) Notes.php not updated to newest sql schema #45

Open
Carbonhell opened this issue Jul 2, 2018 · 1 comment
Open

(tgdb) Notes.php not updated to newest sql schema #45

Carbonhell opened this issue Jul 2, 2018 · 1 comment

Comments

@Carbonhell
Copy link

Notes were merged into the messages table, so those lines need to be updated:
https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L34 should be 'targetckey LIKE' instead of 'ckey LIKE'

https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L40 should be 'text LIKE' instead of 'notetext LIKE'

https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L53 should become
$sqlwhere = " WHERE type LIKE 'note' AND ".join(" ".$sqlwheresep." ", $sqlwherea);
to atleast get the notes, although this could be expanded to also get watchlist/messages/idk i guess

https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L58
$res = $mysqli->query("SELECT id, targetckey, timestamp, text, adminckey, server FROM ".fmttable("notes").$sqlwhere." ORDER BY timestamp DESC LIMIT ".$limit.";");
(although server doesn't work and i am not too sure why)

https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L63
should be $row['targetckey']

https://github.com/tgstation/tgstation13.org/blob/master/tgdb/notes.php#L67
should be $row['text']

server field doesn't appear,that's the only weird thing i've noticed, rest seems to work

@MrStonedOne
Copy link
Contributor

As a work around until i get around to fixing this

ss13memo	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ss13memo` AS select `ss13messages`.`targetckey` AS `ckey`,`ss13messages`.`text` AS `memotext`,`ss13messages`.`timestamp` AS `timestamp`,`ss13messages`.`lasteditor` AS `last_editor`,`ss13messages`.`edits` AS `edits` from `ss13messages` where `ss13messages`.`type` = 'memo' and `ss13messages`.`deleted` = 0
ss13notes	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ss13notes` AS select `ss13messages`.`id` AS `id`,`ss13messages`.`targetckey` AS `ckey`,`ss13messages`.`adminckey` AS `adminckey`,`ss13messages`.`text` AS `notetext`,`ss13messages`.`timestamp` AS `timestamp`,`ss13messages`.`server` AS `server`,`ss13messages`.`secret` AS `secret`,`ss13messages`.`lasteditor` AS `last_editor`,`ss13messages`.`edits` AS `edits` from `ss13messages` where `ss13messages`.`type` = 'note'
ss13watch	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ss13watch` AS select `ss13messages`.`targetckey` AS `ckey`,`ss13messages`.`adminckey` AS `adminckey`,`ss13messages`.`text` AS `reason`,`ss13messages`.`timestamp` AS `timestamp`,`ss13messages`.`lasteditor` AS `last_editor`,`ss13messages`.`edits` AS `edits` from `ss13messages` where `ss13messages`.`type` = 'watchlist entry'

It creates notes, memos and watch "views" from the messages table. they act like tables but are really just a window into data from another table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants