-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9f091c
commit 45763cc
Showing
8 changed files
with
82 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# this file is the entrypoint for the Dockerfile.dev | ||
# and is used for local development | ||
|
||
set -e | ||
|
||
npm install | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
|
||
$SCRIPT_DIR/migrate-dev-db | ||
|
||
npm run dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
TYPES=src/database/types.ts | ||
|
||
npx kysely migrate:up | ||
|
||
npx kysely-codegen --camel-case --dialect postgres --out-file $TYPES | ||
npx prettier --write $TYPES | ||
npx eslint --fix $TYPES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { type Kysely, sql } from 'kysely' | ||
|
||
export async function up(db: Kysely<unknown>): Promise<void> { | ||
// await db.schema | ||
// .createType('study_status') | ||
// .asEnum(['']) | ||
|
||
await db.schema | ||
.createTable('study') | ||
.addColumn('id', 'uuid', (col) => col.primaryKey()) | ||
.addColumn('researcher_id', 'uuid', (col) => col.notNull()) | ||
.addColumn('member_id', 'uuid', (col) => col.notNull()) | ||
.addColumn('name', 'text', (col) => col.notNull()) | ||
.addColumn('data_sources', 'text', (col) => col.notNull()) | ||
.addColumn('output_formats', 'text', (col) => col.notNull()) | ||
.addColumn('container_location', 'text', (col) => col.notNull()) | ||
.addColumn('irb_protocols', 'text') | ||
|
||
.addColumn('approved_at', 'timestamp') | ||
.addColumn('approved_by_member_id', 'uuid') | ||
.addColumn('created_at', 'timestamp', (col) => col.defaultTo(sql`now()`).notNull()) | ||
.addColumn('updated_at', 'timestamp', (col) => col.defaultTo(sql`now()`).notNull()) | ||
.execute() | ||
} | ||
|
||
export async function down(db: Kysely<any>): Promise<void> { | ||
await db.schema.dropTable('study').execute() | ||
} |