initial commit

This commit is contained in:
pablof7z 2023-05-15 20:05:55 +02:00
commit 54de9cfa8e
26 changed files with 6950 additions and 0 deletions

View file

@ -0,0 +1,15 @@
-- CreateTable
CREATE TABLE "KeyUser" (
"keyName" TEXT NOT NULL PRIMARY KEY,
"userNpub" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "SigningCondition" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"kind" INTEGER,
"content" TEXT,
"keyUserKeyName" TEXT,
"allowed" BOOLEAN,
CONSTRAINT "SigningCondition_keyUserKeyName_fkey" FOREIGN KEY ("keyUserKeyName") REFERENCES "KeyUser" ("keyName") ON DELETE SET NULL ON UPDATE CASCADE
);

View file

@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[keyName,userNpub]` on the table `KeyUser` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "KeyUser_keyName_userNpub_key" ON "KeyUser"("keyName", "userNpub");

View file

@ -0,0 +1,34 @@
/*
Warnings:
- The primary key for the `KeyUser` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `userNpub` on the `KeyUser` table. All the data in the column will be lost.
- Added the required column `id` to the `KeyUser` table without a default value. This is not possible if the table is not empty.
- Added the required column `userPubkey` to the `KeyUser` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_KeyUser" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"keyName" TEXT NOT NULL,
"userPubkey" TEXT NOT NULL
);
INSERT INTO "new_KeyUser" ("keyName") SELECT "keyName" FROM "KeyUser";
DROP TABLE "KeyUser";
ALTER TABLE "new_KeyUser" RENAME TO "KeyUser";
CREATE UNIQUE INDEX "KeyUser_keyName_userPubkey_key" ON "KeyUser"("keyName", "userPubkey");
CREATE TABLE "new_SigningCondition" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"kind" INTEGER,
"content" TEXT,
"keyUserKeyName" TEXT,
"allowed" BOOLEAN,
"keyUserId" INTEGER,
CONSTRAINT "SigningCondition_keyUserId_fkey" FOREIGN KEY ("keyUserId") REFERENCES "KeyUser" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
INSERT INTO "new_SigningCondition" ("allowed", "content", "id", "keyUserKeyName", "kind") SELECT "allowed", "content", "id", "keyUserKeyName", "kind" FROM "SigningCondition";
DROP TABLE "SigningCondition";
ALTER TABLE "new_SigningCondition" RENAME TO "SigningCondition";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;

View file

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "SigningCondition" ADD COLUMN "method" TEXT;

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"