Working sorting kinda?
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "ImageSortContext" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"key" TEXT NOT NULL,
|
||||
"index" INTEGER NOT NULL,
|
||||
"imageId" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "ImageSortContext_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ImageSortContext_key_index_idx" ON "ImageSortContext"("key", "index");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "ImageSortContext_key_imageId_key" ON "ImageSortContext"("key", "imageId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ImageSortContext" ADD CONSTRAINT "ImageSortContext_imageId_fkey" FOREIGN KEY ("imageId") REFERENCES "PortfolioImage"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `ImageSortContext` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "ImageSortContext" DROP CONSTRAINT "ImageSortContext_imageId_fkey";
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "ImageSortContext";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "PortfolioSortContext" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"key" TEXT NOT NULL,
|
||||
"index" INTEGER NOT NULL,
|
||||
"imageId" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "PortfolioSortContext_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "PortfolioSortContext_key_index_idx" ON "PortfolioSortContext"("key", "index");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "PortfolioSortContext_key_imageId_key" ON "PortfolioSortContext"("key", "imageId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "PortfolioSortContext" ADD CONSTRAINT "PortfolioSortContext_imageId_fkey" FOREIGN KEY ("imageId") REFERENCES "PortfolioImage"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `index` on the `PortfolioSortContext` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `key` on the `PortfolioSortContext` table. All the data in the column will be lost.
|
||||
- A unique constraint covering the columns `[imageId,year,albumId,type,group]` on the table `PortfolioSortContext` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `albumId` to the `PortfolioSortContext` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `group` to the `PortfolioSortContext` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `sortOrder` to the `PortfolioSortContext` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `type` to the `PortfolioSortContext` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `year` to the `PortfolioSortContext` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX "PortfolioSortContext_key_imageId_key";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "PortfolioSortContext_key_index_idx";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "PortfolioSortContext" DROP COLUMN "index",
|
||||
DROP COLUMN "key",
|
||||
ADD COLUMN "albumId" TEXT NOT NULL,
|
||||
ADD COLUMN "group" TEXT NOT NULL,
|
||||
ADD COLUMN "sortOrder" INTEGER NOT NULL,
|
||||
ADD COLUMN "type" TEXT NOT NULL,
|
||||
ADD COLUMN "year" TEXT NOT NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "PortfolioSortContext_imageId_year_albumId_type_group_key" ON "PortfolioSortContext"("imageId", "year", "albumId", "type", "group");
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `layoutGroup` on the `PortfolioImage` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `layoutOrder` on the `PortfolioImage` table. All the data in the column will be lost.
|
||||
- Made the column `fileType` on table `PortfolioImage` required. This step will fail if there are existing NULL values in that column.
|
||||
- Made the column `fileSize` on table `PortfolioImage` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX "PortfolioImage_albumId_layoutGroup_layoutOrder_idx";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "PortfolioImage_typeId_year_layoutGroup_layoutOrder_idx";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "PortfolioImage" DROP COLUMN "layoutGroup",
|
||||
DROP COLUMN "layoutOrder",
|
||||
ALTER COLUMN "fileType" SET NOT NULL,
|
||||
ALTER COLUMN "fileSize" SET NOT NULL;
|
@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "PortfolioImage" ALTER COLUMN "needsWork" SET DEFAULT true;
|
Reference in New Issue
Block a user