app2-api/script-carga-bd-anterior.sql
2019-07-26 17:54:05 +02:00

158 lines
6.9 KiB
SQL

Cargar
script-carga-bd-users.sql
script-carga-bd-event_types.sql
script-carga-bd-values.sql
script-carga-bd-venues.sql
script-carga-bd-envents_venues_aux.sql
script-carga-bd-speaker_types.sql
script-carga-bd-entidades.sql
insert into lqdvi_v2.`multimedia_files` (id, name, description, type, provider, code, url, createdAt, userId, updatedAt)
SELECT a.id, a.title, a.description, 'video', 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, init_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;
update events e
set e.venueID = (select a.venueID from envents_venues_aux a where a.eventID = e.ID);
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, 'publish', 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, type, provider, url, userId, createdAt, updatedAt)
SELECT UUID() as ID, concat(name, ' - picture'), id as speakerId, 'picture', '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', 'avatar', now(), now() FROM lqdvi_v2.multimedia_files
where name like '%picture%';
insert into lqdvi_v2.multimedia_files (id, name, description, type, provider, url, userId, createdAt, updatedAt)
SELECT UUID() as ID, concat(name, ' - wallpaper'), id as speakerId, 'picture', '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', 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);
//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 LOS DETALLES DE LOS CONGRESOS AGENDAS DE TODOS LOS CONGRESOS
Cargar
script-carga-bd-events_details.sql
update lqdvi_v2.events_details
set type = 'speaker'
where description like'%conference-speaker%';
update lqdvi_v2.events_details
set type = 'info'
where type is null;
//RESERVAS-INVITACIONES
Crear campo entityname (varchar(255)) en tabla events_reservations
insert into lqdvi_v2.events_reservations
(id, init_available_date, end_available_date, gmt, state,
assistants, confirmed, allow_multiple, multiple_limit,
description, reservation_code, color,
allow_overflow, overflow_reservationID, marketing_list,
createdAt, updatedAt, userID,
entityId, eventid, entityname)
SELECT b.id, init_date, end_date, gmt, status,
assistants, confirmed, 0, 0,
b.name as name_invitation, invitation_code, color,
0, null, marketinglist, now(), now(), '0939bb2a-d33d-4290-ac81-fc9faa1c015e',
null, null, a.name
FROM lqdvi.partner a
left join lqdvi.level b on (b.partnerId = a.id);
//COMENTARIOS.....
insert into lqdvi_v2.comments (id, entityId, entityname, content, createdAt, updatedAt, userId)
SELECT UUID() as ID, speakerid, 'speaker', content, created, created, '0939bb2a-d33d-4290-ac81-fc9faa1c015e'
FROM lqdvi.`speaker-comment`;
insert into lqdvi_v2.events_reservations (id, init_available_date, end_available_date, gmt, state,
assistants, confirmed, sold_out, allow_multiple, multiple_limit,
description, reservation_code, color, allow_overflow, overflow_reservationId, marketing_list, createdat, updatedAt, userID, entityId, eventId)
SELECT UUID() as ID, '2019-09-03 00:00:00', '2019-10-03 22:00:00', 2, 'publish',
lqdvi.level.assistants, lqdvi.level.confirmed, lqdvi.level.sold_out, 0, 0,
lqdvi.level.name, lqdvi.level.invitation_code, lqdvi.level.color, 1, null, null,
now(), now(), '0939bb2a-d33d-4290-ac81-fc9faa1c015e', '6c2df93f-af83-11e9-aa90-000c295f0f58','5f772798-5616-4663-a661-b6484dd11bd7'
FROM lqdvi.level
where lqdvi.level.partnerId = '2851f45a-287a-41cc-8258-d50ffe02699b'
insert into events (id, name, description, init_date, init_available_date, end_available_date, gmt,
assistants, confirmed, sold_out, allow_multiple, state, typeid, venueId, userId,
createdAt, updatedAt)
select UUID() as ID, 'Lista de espera - Sevilla 2019', description, now(), init_available_date, end_available_date, gmt,
10000, 0, 0, 0, state, 2, venueId, userId, createdAt, updatedAt
from lqdvi_v2.events
where id = '5f772798-5616-4663-a661-b6484dd11bd7'