diff --git a/sql/swad.sql b/sql/swad.sql index 73c81e910..c9ad01c23 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -126,14 +126,6 @@ CREATE TABLE IF NOT EXISTS ban_banners ( UNIQUE INDEX(BanCod), INDEX(Hidden)); -- --- Table birthdays_today: stores birthdays already congratulated today --- -CREATE TABLE IF NOT EXISTS birthdays_today ( - UsrCod INT NOT NULL, - Today DATE NOT NULL, - UNIQUE INDEX(UsrCod), - INDEX(Today)); --- -- Table buildings: buildings in a center -- CREATE TABLE IF NOT EXISTS buildings ( @@ -1603,6 +1595,14 @@ CREATE TABLE IF NOT EXISTS usr_banned ( UsrCod INT NOT NULL, UNIQUE INDEX(UsrCod)); -- +-- Table usr_birthdays_today: stores birthdays already congratulated today +-- +CREATE TABLE IF NOT EXISTS usr_birthdays_today ( + UsrCod INT NOT NULL, + Today DATE NOT NULL, + UNIQUE INDEX(UsrCod), + INDEX(Today)); +-- -- Table usr_data: stores users' data -- CREATE TABLE IF NOT EXISTS usr_data ( diff --git a/swad_changelog.h b/swad_changelog.h index 66fc4a58c..cc5cf3ef7 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -600,12 +600,16 @@ 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.50.4 (2021-03-17)" +#define Log_PLATFORM_VERSION "SWAD 20.50.5 (2021-03-17)" #define CSS_FILE "swad20.45.css" #define JS_FILE "swad20.6.2.js" /* TODO: Rename CENTRE to CENTER in help wiki. + Version 20.50.5: Mar 17, 2021 Birthdays-today database table renamed. (307288 lines) + 1 change necessary in database: +RENAME TABLE birthdays_today TO usr_birthdays_today; + Version 20.50.4: Mar 17, 2021 Banners database table renamed. (307280 lines) 1 change necessary in database: RENAME TABLE banners TO ban_banners; diff --git a/swad_database.c b/swad_database.c index c45b4d56e..8aa7ad8d1 100644 --- a/swad_database.c +++ b/swad_database.c @@ -358,24 +358,6 @@ mysql> DESCRIBE ban_banners; "UNIQUE INDEX(BanCod)," "INDEX(Hidden))"); - /***** Table birthdays_today *****/ - // Stores birthdays already congratulated today -/* -mysql> DESCRIBE birthdays_today; -+--------+---------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+--------+---------+------+-----+---------+-------+ -| UsrCod | int(11) | NO | PRI | NULL | | -| Today | date | NO | MUL | NULL | | -+--------+---------+------+-----+---------+-------+ -2 rows in set (0.09 sec) -*/ - DB_CreateTable ("CREATE TABLE IF NOT EXISTS birthdays_today (" - "UsrCod INT NOT NULL," - "Today DATE NOT NULL," - "UNIQUE INDEX(UsrCod)," - "INDEX(Today))"); - /***** Table buildings *****/ /* mysql> DESCRIBE buildings; @@ -3394,6 +3376,24 @@ mysql> DESCRIBE usr_banned; "UsrCod INT NOT NULL," "UNIQUE INDEX(UsrCod))"); + /***** Table usr_birthdays_today *****/ + // Stores birthdays already congratulated today +/* +mysql> DESCRIBE usr_birthdays_today; ++--------+---------+------+-----+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++--------+---------+------+-----+---------+-------+ +| UsrCod | int(11) | NO | PRI | NULL | | +| Today | date | NO | MUL | NULL | | ++--------+---------+------+-----+---------+-------+ +2 rows in set (0.09 sec) +*/ + DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_birthdays_today (" + "UsrCod INT NOT NULL," + "Today DATE NOT NULL," + "UNIQUE INDEX(UsrCod)," + "INDEX(Today))"); + /***** Table usr_data *****/ /* mysql> DESCRIBE usr_data; diff --git a/swad_user.c b/swad_user.c index 6b0012b31..09edafea5 100644 --- a/swad_user.c +++ b/swad_user.c @@ -2698,7 +2698,8 @@ static bool Usr_CheckIfMyBirthdayHasNotBeenCongratulated (void) { /***** Delete old birthdays *****/ return (DB_QueryCOUNT ("can not check if my birthday has been congratulated", - "SELECT COUNT(*) FROM birthdays_today" + "SELECT COUNT(*)" + " FROM usr_birthdays_today" " WHERE UsrCod=%ld", Gbl.Usrs.Me.UsrDat.UsrCod) == 0); } @@ -2711,11 +2712,12 @@ static void Usr_InsertMyBirthday (void) { /***** Delete old birthdays *****/ DB_QueryDELETE ("can not delete old birthdays", - "DELETE FROM birthdays_today WHERE Today<>CURDATE()"); + "DELETE FROM usr_birthdays_today" + " WHERE Today<>CURDATE()"); /***** Insert new birthday *****/ DB_QueryINSERT ("can not insert birthday", - "INSERT INTO birthdays_today" + "INSERT INTO usr_birthdays_today" " (UsrCod,Today)" " VALUES" " (%ld,CURDATE())",