combination WIP, add client
This commit is contained in:
1 parent
3c5e7d9aee
commit
4097b05cf9
44 files changed
+22234
-5001
No files matched your search
@@ -0,0 +1,38 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "attachments" (
|
||||
"id" BIGINT NOT NULL,
|
||||
"msgId" BIGINT NOT NULL,
|
||||
"channelId" BIGINT NOT NULL,
|
||||
"memeId" UUID NOT NULL,
|
||||
"url" TEXT NOT NULL,
|
||||
"contentType" TEXT NOT NULL,
|
||||
"message" JSONB NOT NULL,
|
||||
"guild" JSONB NOT NULL,
|
||||
"channel" JSONB NOT NULL,
|
||||
"vision" JSONB NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "attachments_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "memes" (
|
||||
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
|
||||
"url" TEXT NOT NULL,
|
||||
"text" TEXT NOT NULL,
|
||||
"tags" JSONB NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "memes_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "attachments_memeId_key" ON "attachments"("memeId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "attachments_channelId_idx" ON "attachments"("channelId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "attachments" ADD CONSTRAINT "attachments_memeId_fkey" FOREIGN KEY ("memeId") REFERENCES "memes"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[attachmentId]` on the table `memes` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "memes" ADD COLUMN "attachmentId" BIGINT;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "memes_attachmentId_key" ON "memes"("attachmentId");
|
||||
@@ -0,0 +1,9 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "channelhistory" (
|
||||
"id" BIGINT NOT NULL,
|
||||
"earliestMessageId" BIGINT NOT NULL,
|
||||
"latestMessageId" BIGINT NOT NULL,
|
||||
"backfillComplete" BOOLEAN NOT NULL DEFAULT false,
|
||||
|
||||
CONSTRAINT "channelhistory_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `backfillComplete` on the `channelhistory` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "channelhistory" DROP COLUMN "backfillComplete";
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `postedAt` to the `attachments` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `timestamp` to the `memes` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "attachments"
|
||||
ADD COLUMN "postedAt"
|
||||
TIMESTAMP(3);
|
||||
|
||||
UPDATE "attachments"
|
||||
set "postedAt" = TIMESTAMP 'epoch' + ((id >> 22) + 1420070400000) * INTERVAL '1 millisecond';
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "memes"
|
||||
ADD COLUMN "postedAt"
|
||||
TIMESTAMP(3);
|
||||
|
||||
UPDATE "memes"
|
||||
set "postedAt" = TIMESTAMP 'epoch' + (("attachmentId" >> 22) + 1420070400000) * INTERVAL '1 millisecond';
|
||||
|
||||
ALTER TABLE "attachments" ALTER COLUMN "postedAt" SET NOT NULL;
|
||||
ALTER TABLE "memes" ALTER COLUMN "postedAt" SET NOT NULL;
|
||||
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "postgresql"
|
||||
Reference in new issue
Block a user