if ( debug_db ){
dbGetQuery(con,"DROP TABLE IF EXISTS public.bookings;")
dbGetQuery(con,"DROP TABLE IF EXISTS public.rooms;")
dbGetQuery(con,"DROP TABLE IF EXISTS public.users;")
}
## data frame with 0 columns and 0 rows
Users table:
CREATE TABLE public.users (
id VARCHAR(36) NOT NULL PRIMARY KEY,
username text,
type text,
firstname text,
lastname text,
email text,
p_email text,
authlevel text,
comments text,
created TIMESTAMP,
modified TIMESTAMP
);
pander(data.frame( names(users),t(users_dic) ))
| X1 |
id |
id de usuario |
| X2 |
username |
usuario institucional |
| X3 |
type |
tipo de usuario |
| X4 |
firstname |
nombres |
| X5 |
lastname |
apellidos |
| X6 |
email |
correo alterantivo |
| X7 |
p_email |
correo privado |
| X8 |
authlevel |
nivel de autoridad |
| X9 |
comments |
comments |
| X10 |
created |
created |
| X11 |
modified |
modified |
users_df <- dbGetQuery(con,"SELECT * FROM users")
datatable(users, filter = 'bottom', options = list(pageLength = 5))
Rooms table:
rooms <- read.xlsx(hmc_f, sheet = "rooms", colNames = TRUE,
rows = 2:12,
cols = 1:9)
rooms_dic <- read.xlsx(hmc_f, sheet = "rooms", colNames = FALSE,
rows = 1:1,
cols = 1:9)
if ( debug_db ){
dbGetQuery(con,"DROP TABLE IF EXISTS public.rooms;")
rooms_sql <-'
CREATE TABLE public.rooms (
id VARCHAR(36) NOT NULL PRIMARY KEY,
name text,
location text,
available boolean,
comments text,
created TIMESTAMP,
modified TIMESTAMP
);'
dbGetQuery(con,rooms_sql)
#rooms$id <- stri_rand_strings(10, 36)
rooms <- mutate(rooms, created = "2018-09-11 00:38:54", modified = "2018-09-12 00:38:54")
dbWriteTable(con, "rooms", value = rooms, append = TRUE, row.names = FALSE)
}
## [1] TRUE
CREATE TABLE public.rooms (
id VARCHAR(36) NOT NULL PRIMARY KEY,
name text,
location text,
available boolean,
comments text,
created TIMESTAMP,
modified TIMESTAMP
);
pander(data.frame( names(rooms),t(rooms_dic) ))
| X1 |
id |
id unico de usuario |
| X2 |
name |
nombre descriptivo |
| X3 |
location |
Ubicacion fisica |
| X4 |
available |
Si esta disponible para reserva |
| X5 |
comments |
Comentarios |
| X6 |
created |
created |
| X7 |
modified |
modified |
rooms_df <- dbGetQuery(con,"SELECT * FROM rooms")
datatable(rooms_df, filter = 'bottom', options = list(pageLength = 5))
Bokkings table:
CREATE TABLE public.bookings (
id VARCHAR(36) NOT NULL PRIMARY KEY,
room_id VARCHAR(36) REFERENCES rooms(id),
user_id VARCHAR(36) REFERENCES users(id),
date boolean,
comments boolean,
created TIMESTAMP,
modified TIMESTAMP
);
pander(data.frame( names(bookings),t(bookings_dic) ))
| X1 |
id |
Id unico de reserva |
| X2 |
room_id |
id de sala |
| X3 |
user_id |
id de usuario |
| X4 |
date |
fecha de reserva |
| X5 |
comments |
comentarios |
| X6 |
created |
created |
| X7 |
modified |
modified |
datatable(bookings, filter = 'bottom', options = list(pageLength = 5))