Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update setup instructions and seed create parameters for create lab and create job #207

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions prisma/seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function main() {
});
if (!labA) {
labA = await prisma.lab.create({
data: { name: 'Research Lab 1' },
data: { name: 'Research Lab 1' , contactEmail: 'contact@g.ucla.edu', department: "ENGINEERING"},
});
}
const researcherA = await prisma.researcher.upsert({
Expand Down Expand Up @@ -70,15 +70,16 @@ async function main() {
const job = await prisma.job.upsert({
where: { id: 1 },
create: {
startDate: new Date(),
closingDate: new Date(),
closed: false,
title: 'test job',
description: 'test job description',
paid: true,
duration: 'QUARTERLY',
weeklyHours: 10,
credit: true,
location: 'ON_CAMPUS',
//credit: true,
poster: {
connect: {
id: researcherA.id,
Expand Down
11 changes: 8 additions & 3 deletions prisma/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-
sudo apt-get update
sudo apt-get -y install postgresql
```
Confirm installation using ` psql --version `
The default admin user, postgres, needs a password assigned in order to connect to a database.\
To set a password: ` sudo passwd postgres ` Memorize the password for the DB connection string.

Starting `psql` on WSL 2 is done with `sudo service postgresql start`
Then, connecting to the postgres service and opening the psql shell is done with ` sudo -u postgres psql `
Once you have successfully entered the psql shell, you will see your command line change to look like this: `postgres=#`

#### MacOS

Expand All @@ -20,9 +25,8 @@ Starting `psql` on WSL 2 is done with `sudo service postgresql start`
### Setup Database

Assuming we want to use a database called `bresearchdev`.
We log into postgres using `psql postgres`.

Then find out your username using `\du` and create a password using `\password <YourUserName>` and follow the prompts. Memorize the password for the DB connection string.
Find out your username using `\du`.

Create the database with `CREATE DATABASE bresearchdev;`
Connect to the database with `\c bresearchdev`.
Expand All @@ -31,7 +35,8 @@ _You can double check your current databases using `\l`_

### Environment Variables

Create a `.env` (`.env.production` should contain the production url). Set `DATABASE_URL=postgresql://<YOUR POSTGRES USERNAME>:<YOUR PASSWORD HERE>@localhost:5432/bresearchdev?schema=public`
Create a `.env` (`.env.production` should contain the production url).
Set `DATABASE_URL=postgresql://<YOUR POSTGRES USERNAME>:<YOUR PASSWORD HERE>@localhost:5432/bresearchdev?schema=public` and DIRECT_URL which should be the same as DATABASE_URL for local dev.

### Adding Prisma

Expand Down