Repository for the assessment model application
Find a file
2023-07-10 19:19:08 +01:00
drizzle/meta Got drizzle orm working 2023-07-10 17:48:37 +01:00
public Fixed layout on portfolio page, updated the house icons 2023-06-02 16:53:33 +01:00
src Added create_user and also making users table schema changes 2023-07-10 19:14:06 +01:00
.eslintrc.json Initial commit from Create Next App 2023-05-25 06:07:00 +01:00
.gitignore Initial commit from Create Next App 2023-05-25 06:07:00 +01:00
drizzle.config.ts Got drizzle orm working 2023-07-10 17:48:37 +01:00
next.config.js changing defaults, added axiom 2023-05-25 06:57:15 +01:00
package-lock.json Got drizzle orm working 2023-07-10 17:48:37 +01:00
package.json Added shortcut for creating user 2023-07-10 19:19:08 +01:00
postcss.config.js Initial commit from Create Next App 2023-05-25 06:07:00 +01:00
README.md Added shortcut for creating user 2023-07-10 19:19:08 +01:00
tailwind.config.js Got shadcn set up 2023-06-02 11:51:05 +01:00
tsconfig.json revert tsconfig 2023-07-10 19:14:31 +01:00

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Open 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 to automatically optimize and load Inter, a custom Google Font.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

Drizzle ORM

We're using Drizzle ORM to interface with our AWS Postgres database. Documentation on getting set up can be found here

Schemas

In order to get started with Drizzle, a schema needs to be created. Schemas can be added src/app/db/schema as typescript files. See the documentation on how to set up schemas but effectively, Drizzle allows you to define schemas as typescript code, which allows for simple, type safe schema definitions.

Creating Migrations

To create a migration, a command has been set up in package.json. Simply run

npm run migration:generate

Or with yarn/pnmp accordingly.

Note, there seems to be a bug with Drizzle which is documented here.

The workaround is to open up tsconfig.json and comment out "target": "es5", and replace it with "target": "ESNext". This should hopefully only be a temporary workaround required.

Pushing migrations

To push migrations, another command has been set up in package.json, since drizzle-kit currently does not support pushing for Postgres out of the box.

Run

npm run migration:push

Which will commit changes to the database. The database changes will be pushed to the public schema, whereas a meta record will be pushed to the __drizzle_migrations schema.

Inserting users into the database

In order to insert a user into the database, simply run

npm run create_users -- {email} {firstName}

Since we're using just the built in process arguments to read command line arguments, the ordering of arguments needs to be email address and then name