
Cargar
script-carga-bd-users.sql
script-carga-bd-event_types.sql
script-carga-bd-multimedia_types.sql
script-carga-bd-values.sql
script-carga-bd-venues.sql
script-carga-bd-speaker_types.sql

insert into lqdvi_v2.`multimedia_files` (id, name, description, typeid, provider, code, url, createdAt, userId, updatedAt)
SELECT a.id, a.title, a.description, '166fb0aa-5182-4d22-addd-818337194cd7', a.provider, a.code, a.url, a.created, '0939bb2a-d33d-4290-ac81-fc9faa1c015e', now()
FROM lqdvi.`video` as a;


insert into lqdvi_v2.`events` (id, name, description, date, init_available_date, end_available_date, gmt, assistants, confirmed, state, typeId, url_streaming, url_poll, url_registration,
userId, CreatedAt, venueId, campaign_text, UpdatedAt)
SELECT id, title, address , date, avalible, date, GMT, assistants, confirmed, status, typeId, streaming, poll, url_registration, '0939bb2a-d33d-4290-ac81-fc9faa1c015e',
 now(), '120c5a99-6e9b-4cc2-875a-af0f8db00e4b', campaign_text, now()
FROM lqdvi.conference;

insert into lqdvi_v2.speakers
(id, name, description, slogan, twitter, facebook, youtube, linkedin, instagram, web, state, typeId, userId, createdAt, updatedAt)
SELECT id, name, description, slogan, twitter, facebook, youtube, linkedin, instagram, web, 'publicado', 1, '0939bb2a-d33d-4290-ac81-fc9faa1c015e', now(), now()
FROM lqdvi.speaker;

insert into lqdvi_v2.speakers_values (speakerid, valueId, createdAt, updatedAt)
SELECT speakerid, valueid, now(), now() FROM lqdvi.`speaker-value`;

//insertamos los videos relacionados
insert into lqdvi_v2.`multimedias` (id, entityId, entityName, multimediafileId, type, createdAt, updatedAt)
SELECT UUID() as ID, conferenceId as eventID, 'event', videoId as multimediafileid, 'relacion', now(), now() 
FROM lqdvi.`video-conference`
where videoId in (select id from lqdvi_v2.multimedia_files);

//insertamos los videos resumen de cada conferencia
insert into lqdvi_v2.`multimedias` (id, entityId, entityName, multimediafileId, type, createdAt, updatedAt)
SELECT UUID() as ID, Id as eventID, 'event', resume as multimediafileid, 'resume', now(), now() 
FROM lqdvi.`conference`
where resume in (select id from lqdvi_v2.multimedia_files);

//insertamos las imagenes de los ponentes
insert into lqdvi_v2.multimedia_files (id, name, description, typeId, provider, url, userId, createdAt, updatedAt)
SELECT UUID() as ID, concat(name, ' - picture'), id as speakerId, '14c3810c-aca0-440a-b597-f72a7ceb59dc', 'cdn', picture, '0939bb2a-d33d-4290-ac81-fc9faa1c015e', now(), now() FROM lqdvi.speaker
where picture is not null;

insert into lqdvi_v2.multimedias (id, multimediafileid, entityid, entityname, type, createdat, updatedat)
SELECT  UUID() as ID, id as multimediafileid, description as speakerid, 'speaker', 'picture-speaker', now(), now() FROM lqdvi_v2.multimedia_files
where name like '%picture%';

insert into lqdvi_v2.multimedia_files (id, name, description, typeId, provider, url, userId, createdAt, updatedAt)
SELECT UUID() as ID, concat(name, ' - wallpaper'), id as speakerId, '14c3810c-aca0-440a-b597-f72a7ceb59dc', 'cdn', wallpaper, '0939bb2a-d33d-4290-ac81-fc9faa1c015e', now(), now() FROM lqdvi.speaker
where wallpaper is not null;

insert into lqdvi_v2.multimedias (id, multimediafileid, entityid, entityname, type, createdat, updatedat)
SELECT  UUID() as ID, id as multimediafileid, description as speakerid, 'speaker', 'wallpaper-speaker', now(), now() FROM lqdvi_v2.multimedia_files
where name like '%wallpaper%';

insert into lqdvi_v2.`multimedias` (id, entityId, entityName, multimediafileId, type, createdAt, updatedAt)
SELECT UUID() as ID, speakerID as eventID, 'speaker', videoId as multimediafileid, 'relacion-speaker', now(), now() 
FROM lqdvi.`video-speaker`
where videoId in (select id from lqdvi_v2.multimedia_files);

//METEMOS LAS AGENDAS DE TODOS LOS CONGRESOS
Cargar
script-carga-bd-events_schedules.sql

//Modificamos la tabla para crear otro campo autoinc que nos rellene el order
/*
insert into lqdvi_v2.events_schedules (id, eventId, speakerId, description, createdAt, updatedAt)
SELECT id, conferenceId, speakerId,  
CONCAT(DATE_FORMAT(init_hour, "%H:%i"), ' - ', COALESCE(DATE_FORMAT(end_hour, "%H:%i"),''), ' - ',  COALESCE(title,''), ' - ',COALESCE(info,'') ) as description,
now(), now() 
FROM lqdvi.event
order by conferenceId, init_hour;

update lqdvi_v2.events_schedules as a
set a.order = nuevoidorder

insert into lqdvi_v2.events_schedules (id, eventId, speakerId, order, description, createdAt, updatedAt)
select UUID() as ID, conferenceId, speakerId, 0, 'relacion conference-speaker modelo anterior', now(), now() FROM lqdvi.`conference-speaker`;
*/

//Metemos las preguntas de los congresos
insert into lqdvi_v2.events_questions (id, eventId, speakerId, anonimous, answered, discared, answer, userId, createdAt, updatedAt)
SELECT UUID() as ID, conferenceId, speakerId, anonymous, answered, discared, content, '0939bb2a-d33d-4290-ac81-fc9faa1c015e', created, now() FROM lqdvi.question;


//Cargar
script-carga-bd-entidades.sql






