Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sdy
2020-04-24 17:12:27 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
978567dcf8412102665ab11f8d1d3a90acbf8a8e
978567dc
1 parent
cddd1b99
create migration readme
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
124 additions
and
0 deletions
back/prisma/migrations/20200424124259-init/README.md
back/prisma/migrations/20200424124259-init/README.md
0 → 100644
View file @
978567d
# 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
](
./schema.prisma
)
after the migration.
## Database Steps
```
sql
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
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())
```
Please
register
or
login
to post a comment