-
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
f9427bc
commit f4692ee
Showing
9 changed files
with
101 additions
and
42 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
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,20 @@ | ||
import { DB } from './types'; | ||
import { Pool } from 'pg'; | ||
import { Kysely, PostgresDialect } from 'kysely'; | ||
|
||
const dialect = new PostgresDialect({ | ||
pool: new Pool({ | ||
database: process.env.DATABASE_NAME, | ||
host: process.env.DATABASE_HOST, | ||
user: process.env.DATABASE_USER, | ||
password: process.env.DATABASE_PASSWORD, | ||
port: Number(process.env.DATABASE_PORT), | ||
max: Number(process.env.DATABASE_MAX), | ||
}), | ||
}); | ||
|
||
export const db = new Kysely<DB>({ | ||
dialect, | ||
}); | ||
|
||
export type Database = typeof db; |
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,48 @@ | ||
import type { ColumnType } from "kysely"; | ||
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> | ||
? ColumnType<S, I | undefined, U> | ||
: ColumnType<T, T | undefined, T>; | ||
export type Timestamp = ColumnType<Date, Date | string, Date | string>; | ||
|
||
export type Course = { | ||
businessId: string; | ||
facilitySerialNumber: string; | ||
courseId: string; | ||
courseName: string; | ||
itemCode: string; | ||
itemName: string; | ||
instructor: string | null; | ||
startTime: string; | ||
endTime: string; | ||
workday: string; | ||
price: number; | ||
}; | ||
export type Facility = { | ||
businessId: string; | ||
serialNumber: string; | ||
name: string; | ||
cityCode: string; | ||
cityName: string; | ||
localCode: string; | ||
localName: string; | ||
address: string; | ||
detailAddress: string | null; | ||
owner: string; | ||
phone: string | null; | ||
}; | ||
export type SpecialCourse = { | ||
businessId: string; | ||
courseId: string; | ||
courseName: string; | ||
itemName: string; | ||
startTime: string; | ||
endTime: string; | ||
workday: string; | ||
price: number; | ||
type: string; | ||
}; | ||
export type DB = { | ||
Course: Course; | ||
Facility: Facility; | ||
SpecialCourse: SpecialCourse; | ||
}; |
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