You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
540 B
18 lines
540 B
USE dating_app;
|
|
|
|
-- Existing users keep a NULL county until they submit an updated location.
|
|
SET @column_exists = (
|
|
SELECT COUNT(*)
|
|
FROM information_schema.columns
|
|
WHERE table_schema = DATABASE()
|
|
AND table_name = 'user_profiles'
|
|
AND column_name = 'county'
|
|
);
|
|
SET @statement = IF(
|
|
@column_exists = 0,
|
|
'ALTER TABLE user_profiles ADD COLUMN county VARCHAR(120) NULL AFTER city',
|
|
'SELECT 1'
|
|
);
|
|
PREPARE migration_statement FROM @statement;
|
|
EXECUTE migration_statement;
|
|
DEALLOCATE PREPARE migration_statement;
|
|
|