31 lines
1.7 KiB
SQL
31 lines
1.7 KiB
SQL
ALTER TABLE attendees MODIFY COLUMN name VARCHAR(255) NULL;
|
|
ALTER TABLE attendees ADD COLUMN IF NOT EXISTS first_name VARCHAR(255) NOT NULL DEFAULT '' AFTER webinar_id;
|
|
ALTER TABLE attendees ADD COLUMN IF NOT EXISTS last_name VARCHAR(255) NOT NULL DEFAULT '' AFTER first_name;
|
|
ALTER TABLE attendees ADD COLUMN IF NOT EXISTS created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP AFTER company;
|
|
ALTER TABLE attendees ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMP NULL DEFAULT NULL AFTER consented;
|
|
ALTER TABLE attendees ADD COLUMN IF NOT EXISTS how_did_you_hear VARCHAR(255) DEFAULT NULL AFTER timezone;
|
|
UPDATE attendees SET created_at = COALESCE(created_at, registered_at);
|
|
UPDATE attendees
|
|
SET first_name = TRIM(SUBSTRING_INDEX(name, ' ', 1))
|
|
WHERE (first_name = '' OR first_name IS NULL)
|
|
AND name IS NOT NULL
|
|
AND name <> '';
|
|
UPDATE attendees
|
|
SET last_name = TRIM(SUBSTRING(name, CHAR_LENGTH(SUBSTRING_INDEX(name, ' ', 1)) + 1))
|
|
WHERE (last_name = '' OR last_name IS NULL)
|
|
AND name IS NOT NULL
|
|
AND name LIKE '% %';
|
|
INSERT INTO webinars (id, title, description, presenter, scheduled_at)
|
|
SELECT 1,
|
|
'Building Scalable Apps with AppWizzy',
|
|
'The fastest way to go from an idea to a working app you own, running on your server, with your database, using real frameworks.',
|
|
'AppWizzy Team',
|
|
'2026-03-25 18:00:00'
|
|
WHERE NOT EXISTS (SELECT 1 FROM webinars WHERE id = 1);
|
|
UPDATE webinars
|
|
SET title = 'Building Scalable Apps with AppWizzy',
|
|
description = 'The fastest way to go from an idea to a working app you own, running on your server, with your database, using real frameworks.',
|
|
presenter = 'AppWizzy Team',
|
|
scheduled_at = '2026-03-25 18:00:00'
|
|
WHERE id = 1;
|