Download backend/database/migration_google_oauth_auth_provider.sql from archittmittal/Backend_PatientAppointment: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/archittmittal/Backend_PatientAppointment/resolve/main/backend/database/migration_google_oauth_auth_provider.sql
- Command line
-
hf download hf://spaces/archittmittal/Backend_PatientAppointment/backend/database/migration_google_oauth_auth_provider.sql
-
curl -L -o migration_google_oauth_auth_provider.sql https://huggingface.co/spaces/archittmittal/Backend_PatientAppointment/resolve/main/backend/database/migration_google_oauth_auth_provider.sql
1.29 kB
| -- Migration for Issue #222: Add Google Authentication Support | |
| -- Makes password_hash nullable, adds auth_provider and google_id columns | |
| ALTER TABLE users MODIFY password_hash VARCHAR(255) NULL; | |
| -- Add auth_provider if it doesn't exist | |
| SET @dbname = DATABASE(); | |
| SET @tablename = 'users'; | |
| SET @columnname = 'auth_provider'; | |
| SET @preparedStatement = (SELECT IF( | |
| ( | |
| SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS | |
| WHERE | |
| (table_name = @tablename) | |
| AND (table_schema = @dbname) | |
| AND (column_name = @columnname) | |
| ) > 0, | |
| "SELECT 1", | |
| CONCAT("ALTER TABLE ", @tablename, " ADD COLUMN ", @columnname, " VARCHAR(50) DEFAULT 'LOCAL';") | |
| )); | |
| PREPARE alterIfNotExists FROM @preparedStatement; | |
| EXECUTE alterIfNotExists; | |
| DEALLOCATE PREPARE alterIfNotExists; | |
| -- Add google_id if it doesn't exist | |
| SET @columnname2 = 'google_id'; | |
| SET @preparedStatement2 = (SELECT IF( | |
| ( | |
| SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS | |
| WHERE | |
| (table_name = @tablename) | |
| AND (table_schema = @dbname) | |
| AND (column_name = @columnname2) | |
| ) > 0, | |
| "SELECT 1", | |
| CONCAT("ALTER TABLE ", @tablename, " ADD COLUMN ", @columnname2, " VARCHAR(255) UNIQUE;") | |
| )); | |
| PREPARE alterIfNotExists2 FROM @preparedStatement2; | |
| EXECUTE alterIfNotExists2; | |
| DEALLOCATE PREPARE alterIfNotExists2; | |