Skip to content

Commit

Permalink
Specify force install
Browse files Browse the repository at this point in the history
  • Loading branch information
aurorascharff committed May 17, 2024
1 parent 1e24bdc commit 0fa5269
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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

# # URL for local developement, switch prisma type to sqlite in schema.prisma
# DATABASE_URL="file:./dev.db"
# Database connection string
DATABASE_URL=secret
# Shadow database connection string for development
SHADOW_DATABASE_URL=secret
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next

It displays a messaging box using Next 14 with Server Actions, Tailwind CSS, and Prisma, and is progressively enhanced with React 19 features.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Getting Started

First, force install the dependencies to make the React 19 Beta work:

```bash
npm install --force
# or

First, run the development server:

```bash
Expand All @@ -18,15 +26,12 @@ pnpm dev

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Prisma Setup

Add a `.env` file to the root of the project, refer to `.env.sample` for the required environment variables.
You need decide between prisma local development with `sqlite` or a real database with for example `sqlserver`. Define it in the `schema.prisma` file.

Consider adding a `.env` file to the root of the project and using these inside `schema.prisma` with `env("DATABASE_URL")`, refer to `.env.sample`.

After switching, delete the `prisma/migrations` folder before running the migration command.

When using sqlserver, you need to migrate the database schema with:
Expand Down
6 changes: 3 additions & 3 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const USERS: User[] = [
},
];

function seedMessages() {
Promise.all(
async function seedMessages() {
await Promise.all(
USERS.map(n => {
return prisma.user.create({ data: { id: n.id, name: n.name } });
}),
Expand All @@ -39,7 +39,7 @@ function seedMessages() {
.catch(e => {
return console.error('[SEED] Failed to create user records', e);
});
Promise.all(
await Promise.all(
MESSAGES.map(n => {
return prisma.message.create({ data: { content: n.content, createdById: n.createdById } });
}),
Expand Down

0 comments on commit 0fa5269

Please sign in to comment.