pg.duplicates.ts — drizzle-orm Source File
Architecture documentation for pg.duplicates.ts, a typescript file in the drizzle-orm codebase. 2 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 9609c19c_8b25_a41a_64dd_bb468e813c4c["pg.duplicates.ts"] 690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"] 9609c19c_8b25_a41a_64dd_bb468e813c4c --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031 53497908_16e7_977d_e97d_7414884a88a6["pg-core"] 9609c19c_8b25_a41a_64dd_bb468e813c4c --> 53497908_16e7_977d_e97d_7414884a88a6 b6d4e266_6215_e0bb_4db4_fd367e45e104["pg.duplicates.test.ts"] b6d4e266_6215_e0bb_4db4_fd367e45e104 --> 9609c19c_8b25_a41a_64dd_bb468e813c4c style 9609c19c_8b25_a41a_64dd_bb468e813c4c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { relations, sql } from 'drizzle-orm';
import { index, integer, pgTable, serial, timestamp } from 'drizzle-orm/pg-core';
export const artists = pgTable(
'artists',
{
id: serial('id').primaryKey(),
createdAt: timestamp('created_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
updatedAt: timestamp('updated_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
companyId: integer('company_id').notNull(),
},
);
export const members = pgTable('members', {
id: serial('id').primaryKey(),
createdAt: timestamp('created_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
updatedAt: timestamp('updated_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
});
export const artistsToMembers = pgTable(
'artist_to_member',
{
id: serial('id').primaryKey(),
memberId: integer('member_id').notNull(),
artistId: integer('artist_id').notNull(),
},
(table) => ({
memberArtistIndex: index('artist_to_member__artist_id__member_id__idx').on(
table.memberId,
table.artistId,
),
}),
);
export const albums = pgTable(
'albums',
{
id: serial('id').primaryKey(),
createdAt: timestamp('created_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
updatedAt: timestamp('updated_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
artistId: integer('artist_id').notNull(),
},
(table) => ({
artistIndex: index('albums__artist_id__idx').on(table.artistId),
}),
);
// relations
export const artistRelations = relations(artists, ({ many }) => ({
albums: many(albums),
members: many(artistsToMembers),
}));
export const albumRelations = relations(albums, ({ one }) => ({
artist: one(artists, {
fields: [albums.artistId],
references: [artists.id],
}),
}));
export const memberRelations = relations(members, ({ many }) => ({
artists: many(artistsToMembers),
}));
export const artistsToMembersRelations = relations(artistsToMembers, ({ one }) => ({
artist: one(artists, {
fields: [artistsToMembers.artistId],
references: [artists.id],
}),
member: one(members, {
fields: [artistsToMembers.memberId],
references: [members.id],
}),
}));
Domain
Subdomains
Functions
Dependencies
- drizzle-orm
- pg-core
Source
Frequently Asked Questions
What does pg.duplicates.ts do?
pg.duplicates.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, DatabaseDrivers subdomain.
What functions are defined in pg.duplicates.ts?
pg.duplicates.ts defines 6 function(s): albumRelations, albums, artistRelations, artistsToMembers, artistsToMembersRelations, memberRelations.
What does pg.duplicates.ts depend on?
pg.duplicates.ts imports 2 module(s): drizzle-orm, pg-core.
What files import pg.duplicates.ts?
pg.duplicates.ts is imported by 1 file(s): pg.duplicates.test.ts.
Where is pg.duplicates.ts in the architecture?
pg.duplicates.ts is located at integration-tests/tests/relational/issues-schemas/duplicates/pg/pg.duplicates.ts (domain: DrizzleORM, subdomain: DatabaseDrivers, directory: integration-tests/tests/relational/issues-schemas/duplicates/pg).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free