From 6e17eabcd5d0ba16872bf3a6baf30874387d408c Mon Sep 17 00:00:00 2001 From: acanas Date: Fri, 26 Mar 2021 00:11:15 +0100 Subject: [PATCH] Version 20.51.48: Mar 26, 2021 Room MAC addresses database table renamed. --- sql/swad.sql | 16 ++++++++-------- swad_API.c | 6 +++--- swad_changelog.h | 6 +++++- swad_database.c | 6 +++--- swad_room.c | 8 ++++---- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/sql/swad.sql b/sql/swad.sql index 9196ff9ef..40d485b82 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -1214,14 +1214,6 @@ CREATE TABLE IF NOT EXISTS prj_users ( UsrCod INT NOT NULL, UNIQUE INDEX(PrjCod,RoleInProject,UsrCod)); -- --- Table roo_MACs: stores the associations between rooms and MAC addresses --- -CREATE TABLE IF NOT EXISTS roo_MACs ( - RooCod INT NOT NULL AUTO_INCREMENT, - MAC BIGINT NOT NULL, - UNIQUE INDEX(RooCod,MAC), - UNIQUE INDEX(MAC,RooCod)); --- -- Table roo_check_in: stores the history of locations of users -- CREATE TABLE IF NOT EXISTS roo_check_in ( @@ -1233,6 +1225,14 @@ CREATE TABLE IF NOT EXISTS roo_check_in ( INDEX(UsrCod,CheckInTime), INDEX(CheckInTime)); -- +-- Table roo_macs: stores the associations between rooms and MAC addresses +-- +CREATE TABLE IF NOT EXISTS roo_macs ( + RooCod INT NOT NULL AUTO_INCREMENT, + MAC BIGINT NOT NULL, + UNIQUE INDEX(RooCod,MAC), + UNIQUE INDEX(MAC,RooCod)); +-- -- Table roo_rooms: stores the rooms associated to each center -- CREATE TABLE IF NOT EXISTS roo_rooms ( diff --git a/swad_API.c b/swad_API.c index ed6212e09..045b8c96c 100644 --- a/swad_API.c +++ b/swad_API.c @@ -6043,13 +6043,13 @@ int swad__getLocation (struct soap *soap, "roo_rooms.RooCod," // row[10] "roo_rooms.ShortName," // row[11] "roo_rooms.FullName" // row[12] - " FROM roo_MACs," + " FROM roo_macs," "roo_rooms," "bld_buildings," "ctr_centers," "ins_instits" - " WHERE roo_MACs.MAC=%llu" - " AND roo_MACs.RooCod=roo_rooms.RooCod" + " WHERE roo_macs.MAC=%llu" + " AND roo_macs.RooCod=roo_rooms.RooCod" " AND roo_rooms.BldCod=bld_buildings.BldCod" " AND bld_buildings.CtrCod=ctr_centers.CtrCod" " AND ctr_centers.InsCod=ins_instits.InsCod" diff --git a/swad_changelog.h b/swad_changelog.h index 0ffc1a192..601514604 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.47 (2021-03-26)" +#define Log_PLATFORM_VERSION "SWAD 20.51.48 (2021-03-26)" #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.48: Mar 26, 2021 Room MAC addresses database table renamed. (308782 lines) + 1 change necessary in database: +RENAME TABLE roo_MACs TO roo_macs; + Version 20.51.47: Mar 26, 2021 Most frequent actions database table renamed. (308779 lines) 1 change necessary in database: RENAME TABLE act_MFU TO act_frequent; diff --git a/swad_database.c b/swad_database.c index 7060703ac..79efe4dcf 100644 --- a/swad_database.c +++ b/swad_database.c @@ -2598,9 +2598,9 @@ mysql> DESCRIBE roo_rooms; "UNIQUE INDEX(RooCod)," "INDEX(CtrCod,BldCod,Floor))"); - /***** Table roo_MACs *****/ + /***** Table roo_macs *****/ /* -mysql> DESCRIBE roo_MACs; +mysql> DESCRIBE roo_macs; +--------+--------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+--------+------+-----+---------+----------------+ @@ -2609,7 +2609,7 @@ mysql> DESCRIBE roo_MACs; +--------+--------+------+-----+---------+----------------+ 2 rows in set (0.01 sec) */ - DB_CreateTable ("CREATE TABLE IF NOT EXISTS roo_MACs (" + DB_CreateTable ("CREATE TABLE IF NOT EXISTS roo_macs (" "RooCod INT NOT NULL," "MAC BIGINT NOT NULL," // 12 digits hexadecimal number "UNIQUE INDEX(RooCod,MAC)," diff --git a/swad_room.c b/swad_room.c index 3accc268f..01a7c3c9c 100644 --- a/swad_room.c +++ b/swad_room.c @@ -359,7 +359,7 @@ static unsigned Roo_GetMACAddresses (long RooCod,MYSQL_RES **mysql_res) /***** Get MAC addresses from database *****/ return (unsigned) DB_QuerySELECT (mysql_res,"can not get MAC addresses", "SELECT MAC" // row[0] - " FROM roo_MACs" + " FROM roo_macs" " WHERE RooCod=%ld" " ORDER BY MAC", RooCod); @@ -394,7 +394,7 @@ void Roo_ChangeMAC (void) /***** Check if the new MAC is different from the old MAC *****/ if (OldMACnum) DB_QueryDELETE ("can not remove MAC address", - "DELETE FROM roo_MACs" + "DELETE FROM roo_macs" " WHERE RooCod=%ld" " AND MAC=%llu", Roo_EditingRoom->RooCod, @@ -402,7 +402,7 @@ void Roo_ChangeMAC (void) if (NewMACnum) /***** Update the table of rooms-MACs changing the old MAC for the new one *****/ DB_QueryREPLACE ("can not change MAC address", - "REPLACE INTO roo_MACs" + "REPLACE INTO roo_macs" " (RooCod,MAC)" " VALUES" " (%ld,%llu)", @@ -1639,7 +1639,7 @@ static void Roo_CreateRoom (struct Roo_Room *Room) /***** Create MAC address *****/ if (Room->MACnum) DB_QueryINSERT ("can not create MAC address", - "INSERT INTO roo_MACs" + "INSERT INTO roo_macs" " (RooCod,MAC)" " VALUES" " (%ld,%llu)",