Refactor files to export all and no default export.

This commit is contained in:
Bradley Shellnut 2024-08-07 10:01:38 -07:00
parent 02d2800121
commit 488b638d16
28 changed files with 113 additions and 162 deletions

View file

@ -14,7 +14,7 @@ async function resetTable(db: db, table: Table) {
for (const table of [ for (const table of [
schema.categories, schema.categories,
schema.categoriesToExternalIds, schema.categoriesToExternalIdsTable,
schema.categories_to_games, schema.categories_to_games,
schema.collection_items, schema.collection_items,
schema.collections, schema.collections,

View file

@ -0,0 +1,23 @@
import { pgTable, text, uuid } from 'drizzle-orm/pg-core';
import { createId as cuid2 } from '@paralleldrive/cuid2';
import { type InferSelectModel, relations } from 'drizzle-orm';
import {categoriesToExternalIdsTable} from './categoriesToExternalIdsTable';
import { categories_to_games_table } from './categoriesToGames';
import { timestamps } from '../utils';
export const categoriesTable = pgTable('categories', {
id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid')
.unique()
.$defaultFn(() => cuid2()),
name: text('name'),
slug: text('slug'),
...timestamps,
});
export type Categories = InferSelectModel<typeof categoriesTable>;
export const categories_relations = relations(categoriesTable, ({ many }) => ({
categories_to_games: many(categories_to_games_table),
categoriesToExternalIds: many(categoriesToExternalIdsTable),
}));

View file

@ -1,25 +0,0 @@
import { pgTable, text, uuid } from 'drizzle-orm/pg-core';
import { createId as cuid2 } from '@paralleldrive/cuid2';
import { type InferSelectModel, relations } from 'drizzle-orm';
import categoriesToExternalIds from './categoriesToExternalIds';
import categories_to_games from './categoriesToGames';
import { timestamps } from '../utils';
const categories = pgTable('categories', {
id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid')
.unique()
.$defaultFn(() => cuid2()),
name: text('name'),
slug: text('slug'),
...timestamps,
});
export type Categories = InferSelectModel<typeof categories>;
export const categories_relations = relations(categories, ({ many }) => ({
categories_to_games: many(categories_to_games),
categoriesToExternalIds: many(categoriesToExternalIds),
}));
export default categories;

View file

@ -1,14 +1,14 @@
import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core';
import categories from './categories'; import { categoriesTable } from './categories.table';
import externalIds from './externalIds'; import externalIds from './externalIds';
import { relations } from 'drizzle-orm'; import { relations } from 'drizzle-orm';
const categoriesToExternalIds = pgTable( export const categoriesToExternalIdsTable = pgTable(
'categories_to_external_ids', 'categories_to_external_ids',
{ {
categoryId: uuid('category_id') categoryId: uuid('category_id')
.notNull() .notNull()
.references(() => categories.id, { onDelete: 'restrict', onUpdate: 'cascade' }), .references(() => categoriesTable.id, { onDelete: 'restrict', onUpdate: 'cascade' }),
externalId: uuid('external_id') externalId: uuid('external_id')
.notNull() .notNull()
.references(() => externalIds.id, { onDelete: 'restrict', onUpdate: 'cascade' }), .references(() => externalIds.id, { onDelete: 'restrict', onUpdate: 'cascade' }),
@ -23,17 +23,15 @@ const categoriesToExternalIds = pgTable(
); );
export const categoriesToExternalIdsRelations = relations( export const categoriesToExternalIdsRelations = relations(
categoriesToExternalIds, categoriesToExternalIdsTable,
({ one }) => ({ ({ one }) => ({
category: one(categories, { category: one(categoriesTable, {
fields: [categoriesToExternalIds.categoryId], fields: [categoriesToExternalIdsTable.categoryId],
references: [categories.id], references: [categoriesTable.id],
}), }),
externalId: one(externalIds, { externalId: one(externalIds, {
fields: [categoriesToExternalIds.externalId], fields: [categoriesToExternalIdsTable.externalId],
references: [externalIds.id], references: [externalIds.id],
}), }),
}), }),
); );
export default categoriesToExternalIds;

View file

@ -1,14 +1,14 @@
import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm'; import { relations } from 'drizzle-orm';
import categories from './categories'; import { categoriesTable } from './categories.table';
import games from './games'; import games from './games';
const categories_to_games = pgTable( export const categories_to_games_table = pgTable(
'categories_to_games', 'categories_to_games',
{ {
category_id: uuid('category_id') category_id: uuid('category_id')
.notNull() .notNull()
.references(() => categories.id, { onDelete: 'restrict', onUpdate: 'cascade' }), .references(() => categoriesTable.id, { onDelete: 'restrict', onUpdate: 'cascade' }),
game_id: uuid('game_id') game_id: uuid('game_id')
.notNull() .notNull()
.references(() => games.id, { onDelete: 'restrict', onUpdate: 'cascade' }), .references(() => games.id, { onDelete: 'restrict', onUpdate: 'cascade' }),
@ -22,15 +22,14 @@ const categories_to_games = pgTable(
}, },
); );
export const categories_to_games_relations = relations(categories_to_games, ({ one }) => ({ export const categories_to_games_relations = relations(categories_to_games_table, ({ one }) => ({
category: one(categories, { category: one(categoriesTable, {
fields: [categories_to_games.category_id], fields: [categories_to_games_table.category_id],
references: [categories.id], references: [categoriesTable.id],
}), }),
game: one(games, { game: one(games, {
fields: [categories_to_games.game_id], fields: [categories_to_games_table.game_id],
references: [games.id], references: [games.id],
}), }),
})); }));
export default categories_to_games;

View file

@ -1,11 +1,11 @@
import { integer, pgTable, text, uuid } from 'drizzle-orm/pg-core'; import { integer, pgTable, text, uuid } from 'drizzle-orm/pg-core';
import { createId as cuid2 } from '@paralleldrive/cuid2'; import { createId as cuid2 } from '@paralleldrive/cuid2';
import { type InferSelectModel, relations } from 'drizzle-orm'; import { type InferSelectModel, relations } from 'drizzle-orm';
import collections from './collections'; import { collections } from './collections';
import games from './games'; import games from './games';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
const collection_items = pgTable('collection_items', { export const collection_items = pgTable('collection_items', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid') cuid: text('cuid')
.unique() .unique()
@ -32,5 +32,3 @@ export const collection_item_relations = relations(collection_items, ({ one }) =
references: [games.id], references: [games.id],
}), }),
})); }));
export default collection_items;

View file

@ -1,10 +1,10 @@
import { pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'; import { pgTable, text, uuid } from 'drizzle-orm/pg-core';
import { createId as cuid2 } from '@paralleldrive/cuid2'; import { createId as cuid2 } from '@paralleldrive/cuid2';
import { type InferSelectModel, relations } from 'drizzle-orm'; import { type InferSelectModel, relations } from 'drizzle-orm';
import { usersTable } from './users.table'; import { usersTable } from './users.table';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
const collections = pgTable('collections', { export const collections = pgTable('collections', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid') cuid: text('cuid')
.unique() .unique()
@ -25,4 +25,3 @@ export const collection_relations = relations(collections, ({ one }) => ({
export type Collections = InferSelectModel<typeof collections>; export type Collections = InferSelectModel<typeof collections>;
export default collections;

View file

@ -30,5 +30,3 @@ export const expansion_relations = relations(expansions, ({ one }) => ({
references: [games.id], references: [games.id],
}), }),
})); }));
export default expansions;

View file

@ -11,7 +11,7 @@ export const externalIdType = pgEnum('external_id_type', [
'artist', 'artist',
]); ]);
const externalIds = pgTable('external_ids', { export const externalIds = pgTable('external_ids', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid') cuid: text('cuid')
.unique() .unique()
@ -21,5 +21,3 @@ const externalIds = pgTable('external_ids', {
}); });
export type ExternalIds = InferSelectModel<typeof externalIds>; export type ExternalIds = InferSelectModel<typeof externalIds>;
export default externalIds;

View file

@ -1,4 +1,5 @@
import { pgTable, text, uuid } from "drizzle-orm/pg-core"; import { pgTable, text, uuid } from "drizzle-orm/pg-core";
import { type InferSelectModel } from 'drizzle-orm';
import { usersTable } from "./users.table"; import { usersTable } from "./users.table";
import { timestamps } from '../utils'; import { timestamps } from '../utils';
@ -11,4 +12,6 @@ export const federatedIdentityTable = pgTable('federated_identity', {
federated_user_id: text('federated_user_id').notNull(), federated_user_id: text('federated_user_id').notNull(),
federated_username: text('federated_username').notNull(), federated_username: text('federated_username').notNull(),
...timestamps ...timestamps
}); });
export type FederatedIdentity = InferSelectModel<typeof federatedIdentityTable>;

View file

@ -1,13 +1,13 @@
import { index, integer, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'; import { index, integer, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';
import { createId as cuid2 } from '@paralleldrive/cuid2'; import { createId as cuid2 } from '@paralleldrive/cuid2';
import { type InferSelectModel, relations, sql } from 'drizzle-orm'; import { type InferSelectModel, relations, sql } from 'drizzle-orm';
import categoriesToGames from './categoriesToGames'; import {categories_to_games_table} from './categoriesToGames';
import gamesToExternalIds from './gamesToExternalIds'; import {gamesToExternalIds} from './gamesToExternalIds';
import mechanicsToGames from './mechanicsToGames'; import {mechanics_to_games} from './mechanicsToGames';
import publishersToGames from './publishersToGames'; import {publishers_to_games} from './publishersToGames';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
const games = pgTable( export const games = pgTable(
'games', 'games',
{ {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
@ -42,12 +42,10 @@ const games = pgTable(
); );
export const gameRelations = relations(games, ({ many }) => ({ export const gameRelations = relations(games, ({ many }) => ({
categories_to_games: many(categoriesToGames), categories_to_games: many(categories_to_games_table),
mechanics_to_games: many(mechanicsToGames), mechanics_to_games: many(mechanics_to_games),
publishers_to_games: many(publishersToGames), publishers_to_games: many(publishers_to_games),
gamesToExternalIds: many(gamesToExternalIds), gamesToExternalIds: many(gamesToExternalIds),
})); }));
export type Games = InferSelectModel<typeof games>; export type Games = InferSelectModel<typeof games>;
export default games;

View file

@ -1,8 +1,8 @@
import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core';
import games from './games'; import {games} from './games';
import externalIds from './externalIds'; import {externalIds} from './externalIds';
const gamesToExternalIds = pgTable( export const gamesToExternalIds = pgTable(
'games_to_external_ids', 'games_to_external_ids',
{ {
gameId: uuid('game_id') gameId: uuid('game_id')
@ -20,5 +20,3 @@ const gamesToExternalIds = pgTable(
}; };
}, },
); );
export default gamesToExternalIds;

View file

@ -1,36 +1,26 @@
export { usersTable, userRelations as user_relations, type Users } from './users.table'; export * from './categories.table';
export { default as recoveryCodes, type RecoveryCodes } from './recoveryCodes'; export * from './categoriesToExternalIdsTable';
export { export * from './categoriesToGames';
default as password_reset_tokens, export * from './collectionItems';
password_reset_token_relations, export * from './collections';
type PasswordResetTokens, export * from './credentials.table';
} from './passwordResetTokens'; export * from './expansions';
export { default as sessionsTable, type Sessions } from './sessions.table'; export * from './externalIds';
export { default as roles, role_relations, type Roles } from './roles'; export * from './federatedIdentity.table';
export { default as userRoles, user_role_relations, type UserRoles } from './userRoles'; export * from './games';
export { default as collections, collection_relations, type Collections } from './collections'; export * from './gamesToExternalIds';
export { export * from './mechanics';
default as collection_items, export * from './mechanicsToExternalIds';
collection_item_relations, export * from './mechanicsToGames'
type CollectionItems, export * from './passwordResetTokens';
} from './collectionItems'; export * from './publishers';
export { default as wishlists, wishlists_relations, type Wishlists } from './wishlists'; export * from './publishersToExternalIds';
export { export * from './publishersToGames';
default as wishlist_items, export * from './recoveryCodes';
wishlist_item_relations, export * from './roles';
type WishlistItems, export * from './sessions.table';
} from './wishlistItems'; export * from './two-factor.table';
export { default as externalIds, type ExternalIds, externalIdType } from './externalIds'; export * from './userRoles';
export { default as games, gameRelations, type Games } from './games'; export * from './users.table';
export { default as gamesToExternalIds } from './gamesToExternalIds'; export * from './wishlistItems';
export { default as expansions, expansion_relations, type Expansions } from './expansions'; export * from './wishlists';
export { default as publishers, publishers_relations, type Publishers } from './publishers';
export { default as publishers_to_games, publishers_to_games_relations } from './publishersToGames';
export { default as publishersToExternalIds } from './publishersToExternalIds';
export { default as categories, categories_relations, type Categories } from './categories';
export { default as categoriesToExternalIds } from './categoriesToExternalIds';
export { default as categories_to_games, categories_to_games_relations } from './categoriesToGames';
export { default as mechanics, mechanics_relations, type Mechanics } from './mechanics';
export { default as mechanicsToExternalIds } from './mechanicsToExternalIds';
export { default as mechanics_to_games, mechanics_to_games_relations } from './mechanicsToGames';
export { default as twoFactor } from './two-factor.table';

View file

@ -5,7 +5,7 @@ import mechanicsToGames from './mechanicsToGames';
import mechanicsToExternalIds from './mechanicsToExternalIds'; import mechanicsToExternalIds from './mechanicsToExternalIds';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
const mechanics = pgTable('mechanics', { export const mechanics = pgTable('mechanics', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid') cuid: text('cuid')
.unique() .unique()
@ -21,5 +21,3 @@ export const mechanics_relations = relations(mechanics, ({ many }) => ({
mechanics_to_games: many(mechanicsToGames), mechanics_to_games: many(mechanicsToGames),
mechanicsToExternalIds: many(mechanicsToExternalIds), mechanicsToExternalIds: many(mechanicsToExternalIds),
})); }));
export default mechanics;

View file

@ -1,8 +1,8 @@
import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core';
import mechanics from './mechanics'; import {mechanics} from './mechanics';
import externalIds from './externalIds'; import {externalIds} from './externalIds';
const mechanicsToExternalIds = pgTable( export const mechanicsToExternalIds = pgTable(
'mechanics_to_external_ids', 'mechanics_to_external_ids',
{ {
mechanicId: uuid('mechanic_id') mechanicId: uuid('mechanic_id')
@ -20,5 +20,3 @@ const mechanicsToExternalIds = pgTable(
}; };
}, },
); );
export default mechanicsToExternalIds;

View file

@ -1,9 +1,9 @@
import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm'; import { relations } from 'drizzle-orm';
import mechanics from './mechanics'; import {mechanics} from './mechanics';
import games from './games'; import {games} from './games';
const mechanics_to_games = pgTable( export const mechanics_to_games = pgTable(
'mechanics_to_games', 'mechanics_to_games',
{ {
mechanic_id: uuid('mechanic_id') mechanic_id: uuid('mechanic_id')

View file

@ -4,7 +4,7 @@ import { type InferSelectModel, relations } from 'drizzle-orm';
import { usersTable } from './users.table'; import { usersTable } from './users.table';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
const password_reset_tokens = pgTable('password_reset_tokens', { export const password_reset_tokens = pgTable('password_reset_tokens', {
id: text('id') id: text('id')
.primaryKey() .primaryKey()
.$defaultFn(() => cuid2()), .$defaultFn(() => cuid2()),
@ -23,5 +23,3 @@ export const password_reset_token_relations = relations(password_reset_tokens, (
references: [usersTable.id], references: [usersTable.id],
}), }),
})); }));
export default password_reset_tokens;

View file

@ -1,11 +1,11 @@
import { pgTable, text, uuid } from 'drizzle-orm/pg-core'; import { pgTable, text, uuid } from 'drizzle-orm/pg-core';
import { createId as cuid2 } from '@paralleldrive/cuid2'; import { createId as cuid2 } from '@paralleldrive/cuid2';
import { type InferSelectModel, relations } from 'drizzle-orm'; import { type InferSelectModel, relations } from 'drizzle-orm';
import publishers_to_games from './publishersToGames'; import {publishers_to_games} from './publishersToGames';
import publishersToExternalIds from './publishersToExternalIds'; import publishersToExternalIds from './publishersToExternalIds';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
const publishers = pgTable('publishers', { export const publishers = pgTable('publishers', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid') cuid: text('cuid')
.unique() .unique()
@ -21,5 +21,3 @@ export const publishers_relations = relations(publishers, ({ many }) => ({
publishers_to_games: many(publishers_to_games), publishers_to_games: many(publishers_to_games),
publishersToExternalIds: many(publishersToExternalIds), publishersToExternalIds: many(publishersToExternalIds),
})); }));
export default publishers;

View file

@ -1,8 +1,8 @@
import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core';
import publishers from './publishers'; import {publishers} from './publishers';
import externalIds from './externalIds'; import {externalIds} from './externalIds';
const publishersToExternalIds = pgTable( export const publishersToExternalIds = pgTable(
'publishers_to_external_ids', 'publishers_to_external_ids',
{ {
publisherId: uuid('publisher_id') publisherId: uuid('publisher_id')
@ -20,5 +20,3 @@ const publishersToExternalIds = pgTable(
}; };
}, },
); );
export default publishersToExternalIds;

View file

@ -1,9 +1,9 @@
import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core'; import { pgTable, primaryKey, uuid } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm'; import { relations } from 'drizzle-orm';
import publishers from './publishers'; import {publishers} from './publishers';
import games from './games'; import {games} from './games';
const publishers_to_games = pgTable( export const publishers_to_games = pgTable(
'publishers_to_games', 'publishers_to_games',
{ {
publisher_id: uuid('publisher_id') publisher_id: uuid('publisher_id')
@ -32,5 +32,3 @@ export const publishers_to_games_relations = relations(publishers_to_games, ({ o
references: [games.id], references: [games.id],
}), }),
})); }));
export default publishers_to_games;

View file

@ -3,7 +3,7 @@ import type { InferSelectModel } from 'drizzle-orm';
import { usersTable } from './users.table'; import { usersTable } from './users.table';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
const recovery_codes = pgTable('recovery_codes', { export const recovery_codes = pgTable('recovery_codes', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
userId: uuid('user_id') userId: uuid('user_id')
.notNull() .notNull()
@ -14,5 +14,3 @@ const recovery_codes = pgTable('recovery_codes', {
}); });
export type RecoveryCodes = InferSelectModel<typeof recovery_codes>; export type RecoveryCodes = InferSelectModel<typeof recovery_codes>;
export default recovery_codes;

View file

@ -1,10 +1,10 @@
import { pgTable, text, uuid } from 'drizzle-orm/pg-core'; import { pgTable, text, uuid } from 'drizzle-orm/pg-core';
import { createId as cuid2 } from '@paralleldrive/cuid2'; import { createId as cuid2 } from '@paralleldrive/cuid2';
import { type InferSelectModel, relations } from 'drizzle-orm'; import { type InferSelectModel, relations } from 'drizzle-orm';
import user_roles from './userRoles'; import {user_roles} from './userRoles';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
const roles = pgTable('roles', { export const roles = pgTable('roles', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid') cuid: text('cuid')
.unique() .unique()
@ -19,5 +19,3 @@ export type Roles = InferSelectModel<typeof roles>;
export const role_relations = relations(roles, ({ many }) => ({ export const role_relations = relations(roles, ({ many }) => ({
user_roles: many(user_roles), user_roles: many(user_roles),
})); }));
export default roles;

View file

@ -2,7 +2,7 @@ import { boolean, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';
import { relations, type InferSelectModel } from 'drizzle-orm'; import { relations, type InferSelectModel } from 'drizzle-orm';
import { usersTable } from './users.table'; import { usersTable } from './users.table';
const sessionsTable = pgTable('sessions', { export const sessionsTable = pgTable('sessions', {
id: text('id').primaryKey(), id: text('id').primaryKey(),
userId: uuid('user_id') userId: uuid('user_id')
.notNull() .notNull()
@ -25,5 +25,3 @@ export const sessionsRelations = relations(sessionsTable, ({ one }) => ({
})); }));
export type Sessions = InferSelectModel<typeof sessionsTable>; export type Sessions = InferSelectModel<typeof sessionsTable>;
export default sessionsTable;

View file

@ -4,7 +4,7 @@ import { boolean, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
import { usersTable } from './users.table'; import { usersTable } from './users.table';
const twoFactorTable = pgTable('two_factor', { export const twoFactorTable = pgTable('two_factor', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid') cuid: text('cuid')
.unique() .unique()
@ -30,5 +30,3 @@ export const emailVerificationsRelations = relations(twoFactorTable, ({ one }) =
})); }));
export type TwoFactor = InferSelectModel<typeof twoFactorTable>; export type TwoFactor = InferSelectModel<typeof twoFactorTable>;
export default twoFactorTable;

View file

@ -2,10 +2,10 @@ import { boolean, pgTable, text, uuid } from 'drizzle-orm/pg-core';
import { createId as cuid2 } from '@paralleldrive/cuid2'; import { createId as cuid2 } from '@paralleldrive/cuid2';
import { type InferSelectModel, relations } from 'drizzle-orm'; import { type InferSelectModel, relations } from 'drizzle-orm';
import { usersTable } from './users.table'; import { usersTable } from './users.table';
import roles from './roles'; import {roles} from './roles';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
const user_roles = pgTable('user_roles', { export const user_roles = pgTable('user_roles', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid') cuid: text('cuid')
.unique() .unique()
@ -32,5 +32,3 @@ export const user_role_relations = relations(user_roles, ({ one }) => ({
})); }));
export type UserRoles = InferSelectModel<typeof user_roles>; export type UserRoles = InferSelectModel<typeof user_roles>;
export default user_roles;

View file

@ -2,7 +2,7 @@ import { boolean, pgTable, text, uuid } from 'drizzle-orm/pg-core';
import { createId as cuid2 } from '@paralleldrive/cuid2'; import { createId as cuid2 } from '@paralleldrive/cuid2';
import { type InferSelectModel, relations } from 'drizzle-orm'; import { type InferSelectModel, relations } from 'drizzle-orm';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
import user_roles from './userRoles'; import {user_roles} from './userRoles';
export const usersTable = pgTable('users', { export const usersTable = pgTable('users', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),

View file

@ -2,10 +2,10 @@ import { pgTable, text, uuid } from 'drizzle-orm/pg-core';
import { createId as cuid2 } from '@paralleldrive/cuid2'; import { createId as cuid2 } from '@paralleldrive/cuid2';
import { type InferSelectModel, relations } from 'drizzle-orm'; import { type InferSelectModel, relations } from 'drizzle-orm';
import wishlists from './wishlists'; import wishlists from './wishlists';
import games from './games'; import {games} from './games';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
const wishlist_items = pgTable('wishlist_items', { export const wishlist_items = pgTable('wishlist_items', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid') cuid: text('cuid')
.unique() .unique()
@ -31,5 +31,3 @@ export const wishlist_item_relations = relations(wishlist_items, ({ one }) => ({
references: [games.id], references: [games.id],
}), }),
})); }));
export default wishlist_items;

View file

@ -4,7 +4,7 @@ import { type InferSelectModel, relations } from 'drizzle-orm';
import { usersTable } from './users.table'; import { usersTable } from './users.table';
import { timestamps } from '../utils'; import { timestamps } from '../utils';
const wishlists = pgTable('wishlists', { export const wishlists = pgTable('wishlists', {
id: uuid('id').primaryKey().defaultRandom(), id: uuid('id').primaryKey().defaultRandom(),
cuid: text('cuid') cuid: text('cuid')
.unique() .unique()
@ -24,5 +24,3 @@ export const wishlists_relations = relations(wishlists, ({ one }) => ({
references: [usersTable.id], references: [usersTable.id],
}), }),
})); }));
export default wishlists;