Skip to content

Commit

Permalink
created_at for crosshairs
Browse files Browse the repository at this point in the history
  • Loading branch information
saddiqs1 committed Jan 11, 2024
1 parent 6cfc73e commit d530a1d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions database/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
export type Timestamp = ColumnType<Date, Date | string, Date | string>;

export interface Crosshairs {
created_at: Generated<Timestamp>;
crosshair: string;
id: Generated<number>;
name: string;
Expand Down
3 changes: 3 additions & 0 deletions database/migrations/20240110162746945_init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export async function up(db: Kysely<DB>): Promise<void> {
.addColumn('user_id', 'integer', (col) => col.references('users.id'))
.addColumn('crosshair', 'text', (col) => col.notNull())
.addColumn('name', 'text', (col) => col.notNull())
.addColumn('created_at', 'timestamp', (col) =>
col.defaultTo(sql`now()`).notNull()
)
.execute()
}

Expand Down
1 change: 1 addition & 0 deletions src/types/generated/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
export type Timestamp = ColumnType<Date, Date | string, Date | string>;

export interface Crosshairs {
created_at: Generated<Timestamp>;
crosshair: string;
id: Generated<number>;
name: string;
Expand Down

0 comments on commit d530a1d

Please sign in to comment.