mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 18:11:47 +00:00
- Adds the framework that allows soft-deleting books from the library.
This commit is contained in:
15
SQL/database_changelog.txt
Normal file
15
SQL/database_changelog.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
4 November 2013, by Errorage
|
||||
|
||||
The column 'deleted' was added to the erro_library table. If set to anything other than null, the book is interpreted as deleted.
|
||||
|
||||
To update your database, execute the following code in phpmyadmin, mysql workbench or whatever program you use:
|
||||
|
||||
ALTER TABLE erro_library ADD COLUMN deleted TINYINT(1) NULL DEFAULT NULL AFTER datetime;
|
||||
|
||||
If you want to 'soft delete' a book (meaning it remains in the library, but isn't viewable by players), set the value in the 'deleted' column for the row to 1. To undelete, set it back to null. If you're making an admin tool to work with this, execute the following SQL statement to soft-delete the book with id someid:
|
||||
|
||||
UPDATE erro_library SET deleted = 1 WHERE id = someid
|
||||
|
||||
(Replace someid with the id of the book you want to soft delete.)
|
||||
|
||||
----------------------------------------------------
|
||||
@@ -174,6 +174,7 @@ CREATE TABLE `erro_library` (
|
||||
`category` varchar(45) NOT NULL,
|
||||
`ckey` varchar(45) DEFAULT 'LEGACY',
|
||||
`datetime` datetime DEFAULT NULL,
|
||||
`deleted` tinyint(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
|
||||
author = null
|
||||
author = sanitizeSQL(author)
|
||||
if(href_list["search"])
|
||||
SQLquery = "SELECT author, title, category, id FROM erro_library WHERE "
|
||||
SQLquery = "SELECT author, title, category, id FROM erro_library WHERE isnull(deleted) AND "
|
||||
if(category == "Any")
|
||||
SQLquery += "author LIKE '%[author]%' AND title LIKE '%[title]%'"
|
||||
else
|
||||
@@ -201,7 +201,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
|
||||
dat += "<table>"
|
||||
dat += "<tr><td>AUTHOR</td><td>TITLE</td><td>CATEGORY</td><td></td></tr>"
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id, author, title, category FROM erro_library")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id, author, title, category FROM erro_library WHERE isnull(deleted)")
|
||||
query.Execute()
|
||||
|
||||
while(query.NextRow())
|
||||
@@ -370,7 +370,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
|
||||
bibledelay = 1
|
||||
spawn(60)
|
||||
bibledelay = 0
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM erro_library WHERE id=[sqlid]")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM erro_library WHERE id=[sqlid] AND isnull(deleted)")
|
||||
query.Execute()
|
||||
|
||||
while(query.NextRow())
|
||||
|
||||
Reference in New Issue
Block a user