Implement authentication

This commit is contained in:
Jorge Vargas 2024-11-20 16:28:22 -06:00
parent cdcd71cf2a
commit 3e4551ea7a
23 changed files with 656 additions and 406 deletions

View file

@ -0,0 +1,23 @@
-- AlterTable
ALTER TABLE `config` MODIFY `createdAt` DATETIME(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
MODIFY `updatedAt` DATETIME(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0);
-- AlterTable
ALTER TABLE `forgors` MODIFY `createdAt` DATETIME(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
MODIFY `updatedAt` DATETIME(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0);
-- AlterTable
ALTER TABLE `users` MODIFY `createdAt` DATETIME(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
MODIFY `updatedAt` DATETIME(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0);
-- CreateTable
CREATE TABLE `Session` (
`id` VARCHAR(191) NOT NULL,
`username` VARCHAR(255) NOT NULL,
`expiresAt` DATETIME(3) NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `Session` ADD CONSTRAINT `Session_id_fkey` FOREIGN KEY (`id`) REFERENCES `users`(`username`) ON DELETE CASCADE ON UPDATE CASCADE;

View file

@ -0,0 +1,10 @@
/*
Warnings:
- You are about to drop the column `username` on the `Session` table. All the data in the column will be lost.
- Added the required column `userId` to the `Session` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `Session` DROP COLUMN `username`,
ADD COLUMN `userId` VARCHAR(255) NOT NULL;

View file

@ -0,0 +1,5 @@
-- DropForeignKey
ALTER TABLE `Session` DROP FOREIGN KEY `Session_id_fkey`;
-- AddForeignKey
ALTER TABLE `Session` ADD CONSTRAINT `Session_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `users`(`username`) ON DELETE CASCADE ON UPDATE CASCADE;

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 = "mysql"