jedmund-svelte/prisma/migrations/20250619160919_add_album_content_and_geolocation/migration.sql
Justin Edmund 38b62168e9 feat(database): redesign album system with content support and geolocation
- Add album content field for rich text/structured content
- Add geolocation support for albums with position and zoom level
- Remove direct photo-album relationship in favor of MediaAlbum join table
- Support many-to-many relationships between media and albums
- Add Album relation to Universe model for better organization

This enables albums to have rich content beyond just photos and supports
geographic data for location-based albums.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-24 01:10:54 +01:00

24 lines
No EOL
795 B
SQL

-- AlterTable
ALTER TABLE "Album" ADD COLUMN "content" JSONB;
-- CreateTable
CREATE TABLE "GeoLocation" (
"id" SERIAL NOT NULL,
"albumId" INTEGER NOT NULL,
"latitude" DOUBLE PRECISION NOT NULL,
"longitude" DOUBLE PRECISION NOT NULL,
"title" VARCHAR(255) NOT NULL,
"description" TEXT,
"markerColor" VARCHAR(7),
"order" INTEGER NOT NULL DEFAULT 0,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "GeoLocation_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE INDEX "GeoLocation_albumId_idx" ON "GeoLocation"("albumId");
-- AddForeignKey
ALTER TABLE "GeoLocation" ADD CONSTRAINT "GeoLocation_albumId_fkey" FOREIGN KEY ("albumId") REFERENCES "Album"("id") ON DELETE CASCADE ON UPDATE CASCADE;