Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
final-exam
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nawasan Wisitsingkhon
final-exam
Commits
a7a46d8c
Commit
a7a46d8c
authored
Sep 28, 2023
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup prisma to connect to mysql database
parent
9d0ed739
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
88 additions
and
0 deletions
+88
-0
.env.example
.env.example
+8
-0
.gitignore
.gitignore
+1
-0
WelcomeController.js
app/controllers/WelcomeController.js
+1
-0
prismaClient.js
app/models/prismaClient.js
+6
-0
web.js
app/routes/web.js
+0
-0
package.json
package.json
+2
-0
pnpm-lock.yaml
pnpm-lock.yaml
+38
-0
migration.sql
prisma/migrations/20230928134430_dev/migration.sql
+10
-0
migration_lock.toml
prisma/migrations/migration_lock.toml
+4
-0
schema.prisma
prisma/schema.prisma
+18
-0
No files found.
.env.example
0 → 100644
View file @
a7a46d8c
# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
DATABASE_URL="mysql://<username>:<password>@localhost:3306/<db_name>?schema=public"
\ No newline at end of file
.gitignore
View file @
a7a46d8c
...
...
@@ -25,6 +25,7 @@ yarn-debug.log*
yarn-error.log*
# local env files
.env
.env*.local
# vercel
...
...
backend
/controllers/WelcomeController.js
→
app
/controllers/WelcomeController.js
View file @
a7a46d8c
import
{
Request
,
Response
}
from
"express"
;
const
WelcomeController
=
{
/**
*
...
...
app/models/prismaClient.js
0 → 100644
View file @
a7a46d8c
import
{
PrismaClient
}
from
"@prisma/client"
;
const
db
=
new
PrismaClient
();
export
default
db
;
\ No newline at end of file
backend
/routes/web.js
→
app
/routes/web.js
View file @
a7a46d8c
File moved
package.json
View file @
a7a46d8c
...
...
@@ -9,8 +9,10 @@
"lint"
:
"next lint"
},
"dependencies"
:
{
"
@prisma/client
"
:
"5.3.1"
,
"
express
"
:
"^4.18.2"
,
"
next
"
:
"latest"
,
"
prisma
"
:
"^5.3.1"
,
"
react
"
:
"latest"
,
"
react-dom
"
:
"latest"
},
...
...
pnpm-lock.yaml
View file @
a7a46d8c
...
...
@@ -5,12 +5,18 @@ settings:
excludeLinksFromLockfile
:
false
dependencies
:
'
@prisma/client'
:
specifier
:
5.3.1
version
:
5.3.1(prisma@5.3.1)
express
:
specifier
:
^4.18.2
version
:
4.18.2
next
:
specifier
:
latest
version
:
13.5.3(react-dom@18.2.0)(react@18.2.0)
prisma
:
specifier
:
^5.3.1
version
:
5.3.1
react
:
specifier
:
latest
version
:
18.2.0
...
...
@@ -253,6 +259,29 @@ packages:
fastq
:
1.15.0
dev
:
true
/@prisma/client@5.3.1(prisma@5.3.1)
:
resolution
:
{
integrity
:
sha512-ArOKjHwdFZIe1cGU56oIfy7wRuTn0FfZjGuU/AjgEBOQh+4rDkB6nF+AGHP8KaVpkBIiHGPQh3IpwQ3xDMdO0Q==
}
engines
:
{
node
:
'
>=16.13'
}
requiresBuild
:
true
peerDependencies
:
prisma
:
'
*'
peerDependenciesMeta
:
prisma
:
optional
:
true
dependencies
:
'
@prisma/engines-version'
:
5.3.1-2.61e140623197a131c2a6189271ffee05a7aa9a59
prisma
:
5.3.1
dev
:
false
/@prisma/engines-version@5.3.1-2.61e140623197a131c2a6189271ffee05a7aa9a59
:
resolution
:
{
integrity
:
sha512-y5qbUi3ql2Xg7XraqcXEdMHh0MocBfnBzDn5GbV1xk23S3Mq8MGs+VjacTNiBh3dtEdUERCrUUG7Z3QaJ+h79w==
}
dev
:
false
/@prisma/engines@5.3.1
:
resolution
:
{
integrity
:
sha512-6QkILNyfeeN67BNEPEtkgh3Xo2tm6D7V+UhrkBbRHqKw9CTaz/vvTP/ROwYSP/3JT2MtIutZm/EnhxUiuOPVDA==
}
requiresBuild
:
true
dev
:
false
/@rushstack/eslint-patch@1.5.0
:
resolution
:
{
integrity
:
sha512-EF3948ckf3f5uPgYbQ6GhyA56Dmv8yg0+ir+BroRjwdxyZJsekhZzawOecC2rOTPCz173t7ZcR1HHZu0dZgOCw==
}
dev
:
true
...
...
@@ -2249,6 +2278,15 @@ packages:
engines
:
{
node
:
'
>=
0.8.0'
}
dev
:
true
/prisma@5.3.1
:
resolution
:
{
integrity
:
sha512-Wp2msQIlMPHe+5k5Od6xnsI/WNG7UJGgFUJgqv/ygc7kOECZapcSz/iU4NIEzISs3H1W9sFLjAPbg/gOqqtB7A==
}
engines
:
{
node
:
'
>=16.13'
}
hasBin
:
true
requiresBuild
:
true
dependencies
:
'
@prisma/engines'
:
5.3.1
dev
:
false
/prop-types@15.8.1
:
resolution
:
{
integrity
:
sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
}
dependencies
:
...
...
prisma/migrations/20230928134430_dev/migration.sql
0 → 100644
View file @
a7a46d8c
-- CreateTable
CREATE
TABLE
`users`
(
`id`
INTEGER
NOT
NULL
AUTO_INCREMENT
,
`name`
VARCHAR
(
191
)
NOT
NULL
,
`username`
VARCHAR
(
191
)
NOT
NULL
,
`password`
VARCHAR
(
191
)
NOT
NULL
,
UNIQUE
INDEX
`users_username_key`
(
`username`
),
PRIMARY
KEY
(
`id`
)
)
DEFAULT
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
;
prisma/migrations/migration_lock.toml
0 → 100644
View file @
a7a46d8c
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider
=
"mysql"
\ No newline at end of file
prisma/schema.prisma
0 → 100644
View file @
a7a46d8c
//
This
is
your
Prisma
schema
file
,
//
learn
more
about
it
in
the
docs
:
https
://
pris
.
ly
/
d
/
prisma
-
schema
generator
client
{
provider
=
"prisma-client-js"
}
datasource
db
{
provider
=
"mysql"
url
=
env
(
"DATABASE_URL"
)
}
model
users
{
id
Int
@
id
@
default
(
autoincrement
())
name
String
username
String
@
unique
password
String
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment