Name Last Update
..
README.md Loading commit data...
schema.prisma Loading commit data...
steps.json Loading commit data...

Migration 20200424124259-init

This migration has been generated by sdy at 4/24/2020, 12:42:59 PM. You can check out the state of the schema after the migration.

Database Steps

CREATE TABLE `chat_schema`.`User` (
    `avatarUrl` varchar(191)   ,
    `bio` varchar(191)   ,
    `createdAt` datetime  DEFAULT CURRENT_TIMESTAMP ,
    `email` varchar(191) NOT NULL  ,
    `emailSecret` varchar(191)   ,
    `id` int NOT NULL  AUTO_INCREMENT,
    `name` varchar(191) NOT NULL  ,
    `password` varchar(191) NOT NULL  ,
    `phoneNumber` int   ,
    `phoneSecret` varchar(191)   ,
    PRIMARY KEY (`id`)
) 
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci

CREATE TABLE `chat_schema`.`Room` (
    `id` int NOT NULL  AUTO_INCREMENT,
    PRIMARY KEY (`id`)
) 
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci

CREATE TABLE `chat_schema`.`Category` (
    `id` int NOT NULL  AUTO_INCREMENT,
    `name` varchar(191)  DEFAULT '' ,
    PRIMARY KEY (`id`)
) 
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci

CREATE TABLE `chat_schema`.`Message` (
    `id` int NOT NULL  AUTO_INCREMENT,
    `senderId` int NOT NULL ,
    `text` varchar(191)  DEFAULT '' ,
    PRIMARY KEY (`id`)
) 
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci

CREATE TABLE `chat_schema`.`_RoomToUser` (
    `A` int NOT NULL ,
    `B` int NOT NULL 
) 
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci

CREATE TABLE `chat_schema`.`_CategoryToRoom` (
    `A` int NOT NULL ,
    `B` int NOT NULL 
) 
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci

CREATE UNIQUE INDEX `User.email` ON `chat_schema`.`User`(`email`)

CREATE UNIQUE INDEX `_RoomToUser_AB_unique` ON `chat_schema`.`_RoomToUser`(`A`,`B`)

CREATE  INDEX `_RoomToUser_B_index` ON `chat_schema`.`_RoomToUser`(`B`)

CREATE UNIQUE INDEX `_CategoryToRoom_AB_unique` ON `chat_schema`.`_CategoryToRoom`(`A`,`B`)

CREATE  INDEX `_CategoryToRoom_B_index` ON `chat_schema`.`_CategoryToRoom`(`B`)

ALTER TABLE `chat_schema`.`Message` ADD FOREIGN KEY (`senderId`) REFERENCES `chat_schema`.`User`(`id`) ON DELETE CASCADE ON UPDATE CASCADE

ALTER TABLE `chat_schema`.`_RoomToUser` ADD FOREIGN KEY (`A`) REFERENCES `chat_schema`.`Room`(`id`) ON DELETE CASCADE ON UPDATE CASCADE

ALTER TABLE `chat_schema`.`_RoomToUser` ADD FOREIGN KEY (`B`) REFERENCES `chat_schema`.`User`(`id`) ON DELETE CASCADE ON UPDATE CASCADE

ALTER TABLE `chat_schema`.`_CategoryToRoom` ADD FOREIGN KEY (`A`) REFERENCES `chat_schema`.`Category`(`id`) ON DELETE CASCADE ON UPDATE CASCADE

ALTER TABLE `chat_schema`.`_CategoryToRoom` ADD FOREIGN KEY (`B`) REFERENCES `chat_schema`.`Room`(`id`) ON DELETE CASCADE ON UPDATE CASCADE

DROP TABLE `chat_schema`.`_categorytoroom`;

DROP TABLE `chat_schema`.`_migration`;

DROP TABLE `chat_schema`.`_roomtouser`;

DROP TABLE `chat_schema`.`category`;

DROP TABLE `chat_schema`.`message`;

DROP TABLE `chat_schema`.`room`;

DROP TABLE `chat_schema`.`test`;

DROP TABLE `chat_schema`.`user`;

Changes

diff --git schema.prisma schema.prisma
migration 20200419160117-init..20200424124259-init
--- datamodel.dml
+++ datamodel.dml
@@ -4,18 +4,20 @@
 }
 datasource db {
   provider = "mysql"
-  url = "***"
+  url      = env("DATABASE_URL")
 }
 model User {
   id          Int       @default(autoincrement()) @id
   avatarUrl   String?
   email       String    @unique
   password    String
   name        String
-  loginSecret String?
+  phoneNumber Int?
+  emailSecret String?
+  phoneSecret String?
   bio         String?
   rooms       Room[]    @relation(references: [id])
   messages    Message[]
   createdAt   DateTime? @default(now())