forked from CyberAgentHack/web-speed-hackathon-2024
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
Showing
8 changed files
with
196 additions
and
152 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
/* eslint-disable sort/object-properties */ | ||
import { randomUUID } from 'node:crypto'; | ||
|
||
import { sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
import { index, sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
|
||
export const author = sqliteTable('author', { | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
export const author = sqliteTable( | ||
'author', | ||
{ | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
|
||
// columns | ||
name: text('name').notNull(), | ||
description: text('description').notNull(), | ||
// columns | ||
name: text('name').notNull(), | ||
description: text('description').notNull(), | ||
|
||
// relations | ||
imageId: text('image_id').notNull(), | ||
// relations | ||
imageId: text('image_id').notNull(), | ||
|
||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}); | ||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}, | ||
(table) => ({ | ||
createdAtIdx: index('created_at_idx').on(table.createdAt), | ||
}), | ||
); |
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 |
---|---|---|
@@ -1,29 +1,35 @@ | ||
/* eslint-disable sort/object-properties */ | ||
import { randomUUID } from 'node:crypto'; | ||
|
||
import { sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
import { index, sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
|
||
export const book = sqliteTable('book', { | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
export const book = sqliteTable( | ||
'book', | ||
{ | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
|
||
// columns | ||
description: text('description').notNull(), | ||
name: text('name').notNull(), | ||
nameRuby: text('name_ruby').notNull(), | ||
// columns | ||
description: text('description').notNull(), | ||
name: text('name').notNull(), | ||
nameRuby: text('name_ruby').notNull(), | ||
|
||
// relations | ||
imageId: text('image_id').notNull(), | ||
authorId: text('author_id').notNull(), | ||
releaseId: text('release_id').notNull(), | ||
// relations | ||
imageId: text('image_id').notNull(), | ||
authorId: text('author_id').notNull(), | ||
releaseId: text('release_id').notNull(), | ||
|
||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}); | ||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}, | ||
(table) => ({ | ||
createdAtIdx: index('created_at_idx').on(table.createdAt), | ||
}), | ||
); |
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 |
---|---|---|
@@ -1,29 +1,35 @@ | ||
/* eslint-disable sort/object-properties */ | ||
import { randomUUID } from 'node:crypto'; | ||
|
||
import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
import { index, integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
|
||
export const episode = sqliteTable('episode', { | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
export const episode = sqliteTable( | ||
'episode', | ||
{ | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
|
||
// columns | ||
name: text('name').notNull(), | ||
nameRuby: text('name_ruby').notNull(), | ||
description: text('description').notNull(), | ||
chapter: integer('chapter').notNull(), | ||
// columns | ||
name: text('name').notNull(), | ||
nameRuby: text('name_ruby').notNull(), | ||
description: text('description').notNull(), | ||
chapter: integer('chapter').notNull(), | ||
|
||
// relations | ||
bookId: text('book_id').notNull(), | ||
imageId: text('image_id').notNull(), | ||
// relations | ||
bookId: text('book_id').notNull(), | ||
imageId: text('image_id').notNull(), | ||
|
||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}); | ||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}, | ||
(table) => ({ | ||
bookChapIdx: index('book_chap_idx').on(table.bookId, table.chapter), | ||
}), | ||
); |
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 |
---|---|---|
@@ -1,26 +1,32 @@ | ||
/* eslint-disable sort/object-properties */ | ||
import { randomUUID } from 'node:crypto'; | ||
|
||
import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
import { index, integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
|
||
export const episodePage = sqliteTable('episode_page', { | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
export const episodePage = sqliteTable( | ||
'episode_page', | ||
{ | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
|
||
// columns | ||
page: integer('page').notNull(), | ||
// columns | ||
page: integer('page').notNull(), | ||
|
||
// relations | ||
episodeId: text('episode_id').notNull(), | ||
imageId: text('image_id').notNull(), | ||
// relations | ||
episodeId: text('episode_id').notNull(), | ||
imageId: text('image_id').notNull(), | ||
|
||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}); | ||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}, | ||
(table) => ({ | ||
episodePageIdx: index('episode_page_idx').on(table.episodeId, table.page), | ||
}), | ||
); |
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 |
---|---|---|
@@ -1,22 +1,26 @@ | ||
/* eslint-disable sort/object-properties */ | ||
import { randomUUID } from 'node:crypto'; | ||
|
||
import { sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
import { index, sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
|
||
export const feature = sqliteTable('feature', { | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
export const feature = sqliteTable( | ||
'feature', | ||
{ | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
|
||
// relations | ||
bookId: text('book_id').notNull(), | ||
// relations | ||
bookId: text('book_id').notNull(), | ||
|
||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}); | ||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}, | ||
(table) => ({ createdAtIdx: index('created_at_idx').on(table.createdAt) }), | ||
); |
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 |
---|---|---|
@@ -1,25 +1,29 @@ | ||
/* eslint-disable sort/object-properties */ | ||
import { randomUUID } from 'node:crypto'; | ||
|
||
import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
import { index, integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
|
||
export const ranking = sqliteTable('ranking', { | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
export const ranking = sqliteTable( | ||
'ranking', | ||
{ | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
|
||
// columns | ||
rank: integer('rank').notNull(), | ||
// columns | ||
rank: integer('rank').notNull(), | ||
|
||
// relations | ||
bookId: text('book_id').notNull(), | ||
// relations | ||
bookId: text('book_id').notNull(), | ||
|
||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}); | ||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}, | ||
(table) => ({ rankIdx: index('rank_idx').on(table.rank) }), | ||
); |
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 |
---|---|---|
@@ -1,22 +1,28 @@ | ||
/* eslint-disable sort/object-properties */ | ||
import { randomUUID } from 'node:crypto'; | ||
|
||
import { sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
import { index, sqliteTable, text } from 'drizzle-orm/sqlite-core'; | ||
|
||
export const release = sqliteTable('release', { | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
export const release = sqliteTable( | ||
'release', | ||
{ | ||
// primary key | ||
id: text('id') | ||
.primaryKey() | ||
.$defaultFn(() => randomUUID()), | ||
|
||
// columns | ||
dayOfWeek: text('day_of_week').notNull(), | ||
// columns | ||
dayOfWeek: text('day_of_week').notNull(), | ||
|
||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}); | ||
// metadata | ||
createdAt: text('created_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
updatedAt: text('updated_at') | ||
.notNull() | ||
.$defaultFn(() => new Date().toISOString()), | ||
}, | ||
(table) => ({ | ||
dayOfWeekIdx: index('day_of_week_idx').on(table.dayOfWeek), | ||
}), | ||
); |
Oops, something went wrong.