initial version

This commit is contained in:
Danny Morabito 2024-12-02 14:28:00 +01:00
commit ebec73a666
Signed by: dannym
GPG key ID: 7CC8056A5A04557E
14 changed files with 546 additions and 0 deletions

View file

@ -0,0 +1,29 @@
-- CreateTable
CREATE TABLE "users" (
"npub" TEXT NOT NULL PRIMARY KEY,
"registeredAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"lastPayment" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"subscriptionDuration" INTEGER
);
-- CreateTable
CREATE TABLE "aliases" (
"npub" TEXT NOT NULL,
"alias" TEXT NOT NULL,
PRIMARY KEY ("npub", "alias"),
CONSTRAINT "aliases_npub_fkey" FOREIGN KEY ("npub") REFERENCES "users" ("npub") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "mail_queue" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"alias" TEXT NOT NULL,
"sender" TEXT NOT NULL,
"data" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "mail_queue_alias_fkey" FOREIGN KEY ("alias") REFERENCES "aliases" ("alias") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "aliases_alias_key" ON "aliases"("alias");

View file

@ -0,0 +1,10 @@
/*
Warnings:
- You are about to drop the `mail_queue` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropTable
PRAGMA foreign_keys=off;
DROP TABLE "mail_queue";
PRAGMA foreign_keys=on;

View file

@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "sqlite"