Files
ocean-cleanup/server/prisma/migrations/20241116000001_add_clerk_auth/migration.sql
Paul Bailey fc2fff5cb1 feat: Configure database with Prisma and MySQL spatial support (Task 22)
- Set up MySQL 8.0+ with spatial data support (POINT SRID 4326)
- Created Prisma schema with all models (User, Report, Event, etc.)
- Added Clerk authentication support (clerk_id field)
- Configured spatial indexes on location fields for performance
- Created database migrations and applied to MySQL
- Built spatial query utilities for geographical operations
- Added database connection singleton and health checks
- Created comprehensive documentation and test scripts

Requirements: 1.1, 2.1, 3.2, 4.1
2025-11-16 18:46:00 +00:00

14 lines
622 B
SQL

-- AlterTable: Add clerk_id column and remove password_hash
ALTER TABLE `users` ADD COLUMN `clerk_id` VARCHAR(255) NULL;
-- Create unique index on clerk_id
CREATE UNIQUE INDEX `clerk_id` ON `users`(`clerk_id`);
-- Create index for clerk_id lookups
CREATE INDEX `idx_clerk_id` ON `users`(`clerk_id`);
-- Drop password_hash column (after data migration if needed)
-- Note: In production, you would first migrate existing users to Clerk before dropping this column
-- For now, we'll keep it to avoid data loss, but it should be removed after Clerk migration is complete
-- ALTER TABLE `users` DROP COLUMN `password_hash`;