diff --git a/sql/swad.sql b/sql/swad.sql index 7571f9326..616c17f0d 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -996,14 +996,6 @@ CREATE TABLE IF NOT EXISTS ntf_mail_domains ( UNIQUE INDEX(MaiCod), UNIQUE INDEX(Domain)); -- --- Table marks_properties: stores information about files of marks --- -CREATE TABLE IF NOT EXISTS marks_properties ( - FilCod INT NOT NULL AUTO_INCREMENT, - Header INT NOT NULL, - Footer INT NOT NULL, - UNIQUE INDEX(FilCod)); --- -- Table med_media: stores information about media (images, videos, YouTube) -- CREATE TABLE IF NOT EXISTS med_media ( @@ -1015,6 +1007,14 @@ CREATE TABLE IF NOT EXISTS med_media ( UNIQUE INDEX(MedCod), INDEX(Type)); -- +-- Table mrk_marks: stores information about files of marks +-- +CREATE TABLE IF NOT EXISTS mrk_marks ( + FilCod INT NOT NULL AUTO_INCREMENT, + Header INT NOT NULL, + Footer INT NOT NULL, + UNIQUE INDEX(FilCod)); +-- -- Table msg_banned: stores the users whose messages are banned (FromUsrCod is a recipien banned from ToUsrCod) -- CREATE TABLE IF NOT EXISTS msg_banned ( diff --git a/swad_changelog.h b/swad_changelog.h index 6ab3a97b2..cc6c32916 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -600,13 +600,17 @@ TODO: Salvador Romero Cort TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria. */ -#define Log_PLATFORM_VERSION "SWAD 20.51.25 (2021-03-20)" +#define Log_PLATFORM_VERSION "SWAD 20.51.26 (2021-03-20)" #define CSS_FILE "swad20.45.css" #define JS_FILE "swad20.6.2.js" /* TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams + Version 20.51.26: Mar 20, 2021 Marks database table renamed. (308209 lines) + 1 change necessary in database: +RENAME TABLE marks_properties TO mrk_marks; + Version 20.51.25: Mar 20, 2021 Plugins database table renamed. (308202 lines) 1 change necessary in database: RENAME TABLE plugins TO plg_plugins; diff --git a/swad_database.c b/swad_database.c index 724192ec7..9e8e465a4 100644 --- a/swad_database.c +++ b/swad_database.c @@ -2084,24 +2084,6 @@ mysql> DESCRIBE ntf_mail_domains; "UNIQUE INDEX(MaiCod)," "UNIQUE INDEX(Domain))"); - /***** Table marks_properties *****/ -/* -mysql> DESCRIBE marks_properties; -+--------+---------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+--------+---------+------+-----+---------+-------+ -| FilCod | int(11) | NO | PRI | NULL | | -| Header | int(11) | NO | | NULL | | -| Footer | int(11) | NO | | NULL | | -+--------+---------+------+-----+---------+-------+ -3 rows in set (0.00 sec) -*/ - DB_CreateTable ("CREATE TABLE IF NOT EXISTS marks_properties (" - "FilCod INT NOT NULL," - "Header INT NOT NULL," - "Footer INT NOT NULL," - "UNIQUE INDEX(FilCod))"); - /***** Table med_media *****/ /* mysql> DESCRIBE med_media; @@ -2125,6 +2107,24 @@ mysql> DESCRIBE med_media; "UNIQUE INDEX(MedCod)," "INDEX(Type))"); + /***** Table mrk_marks *****/ +/* +mysql> DESCRIBE mrk_marks; ++--------+---------+------+-----+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++--------+---------+------+-----+---------+-------+ +| FilCod | int(11) | NO | PRI | NULL | | +| Header | int(11) | NO | | NULL | | +| Footer | int(11) | NO | | NULL | | ++--------+---------+------+-----+---------+-------+ +3 rows in set (0.00 sec) +*/ + DB_CreateTable ("CREATE TABLE IF NOT EXISTS mrk_marks (" + "FilCod INT NOT NULL," + "Header INT NOT NULL," + "Footer INT NOT NULL," + "UNIQUE INDEX(FilCod))"); + /***** Table msg_banned *****/ /* mysql> DESCRIBE msg_banned; diff --git a/swad_file_browser.c b/swad_file_browser.c index b7bf47906..6087cd851 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -4390,12 +4390,12 @@ void Brw_RemoveCrsFilesFromDB (long CrsCod) /***** Remove format of files of marks *****/ DB_QueryDELETE ("can not remove the properties of marks" " associated to a course", - "DELETE FROM marks_properties" + "DELETE FROM mrk_marks" " USING brw_files," - "marks_properties" + "mrk_marks" " WHERE brw_files.FileBrowser=%u" " AND brw_files.Cod=%ld" - " AND brw_files.FilCod=marks_properties.FilCod", + " AND brw_files.FilCod=mrk_marks.FilCod", (unsigned) Brw_ADMI_MRK_CRS, CrsCod); @@ -4627,12 +4627,12 @@ void Brw_RemoveGrpFilesFromDB (long GrpCod) /***** Remove format of files of marks *****/ DB_QueryDELETE ("can not remove the properties of marks" " associated to a group", - "DELETE FROM marks_properties" + "DELETE FROM mrk_marks" " USING brw_files," - "marks_properties" + "mrk_marks" " WHERE brw_files.FileBrowser=%u" " AND brw_files.Cod=%ld" - " AND brw_files.FilCod=marks_properties.FilCod", + " AND brw_files.FilCod=mrk_marks.FilCod", (unsigned) Brw_ADMI_MRK_GRP, GrpCod); @@ -11260,14 +11260,16 @@ static void Brw_RemoveOneFileOrFolderFromDB (const char Path[PATH_MAX + 1]) if (FileBrowser == Brw_ADMI_MRK_CRS || FileBrowser == Brw_ADMI_MRK_GRP) DB_QueryDELETE ("can not remove properties of marks from database", - "DELETE FROM marks_properties" + "DELETE FROM mrk_marks" " USING brw_files," - "marks_properties" + "mrk_marks" " WHERE brw_files.FileBrowser=%u" " AND brw_files.Cod=%ld" " AND brw_files.Path='%s'" - " AND brw_files.FilCod=marks_properties.FilCod", - (unsigned) FileBrowser,Cod,Path); + " AND brw_files.FilCod=mrk_marks.FilCod", + (unsigned) FileBrowser, + Cod, + Path); /***** Remove from database the entries that store the file views *****/ DB_QueryDELETE ("can not remove file views from database", @@ -11311,14 +11313,16 @@ static void Brw_RemoveChildrenOfFolderFromDB (const char Path[PATH_MAX + 1]) if (FileBrowser == Brw_ADMI_MRK_CRS || FileBrowser == Brw_ADMI_MRK_GRP) DB_QueryDELETE ("can not remove properties of marks from database", - "DELETE FROM marks_properties" + "DELETE FROM mrk_marks" " USING brw_files," - "marks_properties" + "mrk_marks" " WHERE brw_files.FileBrowser=%u" " AND brw_files.Cod=%ld" " AND brw_files.Path LIKE '%s/%%'" - " AND brw_files.FilCod=marks_properties.FilCod", - (unsigned) FileBrowser,Cod,Path); + " AND brw_files.FilCod=mrk_marks.FilCod", + (unsigned) FileBrowser, + Cod, + Path); /***** Remove from database the entries that store the file views *****/ DB_QueryDELETE ("can not remove file views from database", diff --git a/swad_mark.c b/swad_mark.c index f342c7827..3ea794ad7 100644 --- a/swad_mark.c +++ b/swad_mark.c @@ -91,7 +91,7 @@ void Mrk_AddMarksToDB (long FilCod,struct MarksProperties *Marks) { /***** Add file of marks to the database *****/ DB_QueryINSERT ("can not add properties of marks to database", - "INSERT INTO marks_properties" + "INSERT INTO mrk_marks" " (FilCod,%s,%s)" " VALUES" " (%ld,%u,%u)", @@ -177,14 +177,14 @@ static void Mrk_GetNumRowsHeaderAndFooter (struct MarksProperties *Marks) get the number of rows of the more recent file. */ NumRows = DB_QuerySELECT (&mysql_res,"can not get the number of rows" " in header and footer", - "SELECT marks_properties.%s," // row[0] - "marks_properties.%s" // row[1] + "SELECT mrk_marks.%s," // row[0] + "mrk_marks.%s" // row[1] " FROM brw_files," - "marks_properties" + "mrk_marks" " WHERE brw_files.FileBrowser=%u" " AND brw_files.Cod=%ld" " AND brw_files.Path='%s'" - " AND brw_files.FilCod=marks_properties.FilCod" + " AND brw_files.FilCod=mrk_marks.FilCod" " ORDER BY brw_files.FilCod DESC" " LIMIT 1", // On duplicate entries, get the more recent Mrk_HeadOrFootStr[Brw_HEADER], @@ -255,13 +255,13 @@ static void Mrk_ChangeNumRowsHeaderOrFooter (Brw_HeadOrFoot_t HeaderOrFooter) /***** Update properties of marks in the database *****/ Cod = Brw_GetCodForFiles (); DB_QueryUPDATE ("can not update properties of marks", - "UPDATE marks_properties," + "UPDATE mrk_marks," "brw_files" - " SET marks_properties.%s=%u" + " SET mrk_marks.%s=%u" " WHERE brw_files.FileBrowser=%u" " AND brw_files.Cod=%ld" " AND brw_files.Path='%s'" - " AND brw_files.FilCod=marks_properties.FilCod", + " AND brw_files.FilCod=mrk_marks.FilCod", Mrk_HeadOrFootStr[HeaderOrFooter],NumRows, (unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type], Cod, @@ -732,12 +732,12 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], "SELECT brw_files.FileBrowser," "brw_files.Cod," "brw_files.Path," - "marks_properties.Header," - "marks_properties.Footer" + "mrk_marks.Header," + "mrk_marks.Footer" " FROM brw_files," - "marks_properties" + "mrk_marks" " WHERE brw_files.FilCod=%ld" - " AND brw_files.FilCod=marks_properties.FilCod", + " AND brw_files.FilCod=mrk_marks.FilCod", MrkCod) == 1) // Result should have a unique row { /***** Get data of this file of marks *****/