mysql.duplicates.ts — drizzle-orm Source File
Architecture documentation for mysql.duplicates.ts, a typescript file in the drizzle-orm codebase. 2 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 0e3ea012_83be_1507_9e4e_4ce295299c3a["mysql.duplicates.ts"] 690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"] 0e3ea012_83be_1507_9e4e_4ce295299c3a --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031 93ed9350_daa0_6c21_81a6_ed6b2a48bbdf["mysql-core"] 0e3ea012_83be_1507_9e4e_4ce295299c3a --> 93ed9350_daa0_6c21_81a6_ed6b2a48bbdf 3e9a9ed8_ae7a_d028_088e_71256810a1f1["mysql.duplicates.test.ts"] 3e9a9ed8_ae7a_d028_088e_71256810a1f1 --> 0e3ea012_83be_1507_9e4e_4ce295299c3a style 0e3ea012_83be_1507_9e4e_4ce295299c3a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { relations, sql } from 'drizzle-orm';
import { boolean, date, index, int, mysqlEnum, mysqlTable, serial, timestamp, varchar } from 'drizzle-orm/mysql-core';
export const artists = mysqlTable(
'artists',
{
id: serial('id').primaryKey(),
createdAt: timestamp('created_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
updatedAt: timestamp('updated_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
nameEn: varchar('name_en', { length: 50 }).notNull(),
nameKr: varchar('name_kr', { length: 50 }).notNull(),
debut: date('debut').notNull(),
companyId: int('company_id').notNull(),
isGroup: boolean('is_group').notNull().default(true),
image: varchar('image', { length: 255 }).notNull(),
twitter: varchar('twitter', { length: 255 }).notNull(),
instagram: varchar('instagram', { length: 255 }).notNull(),
youtube: varchar('youtube', { length: 255 }).notNull(),
website: varchar('website', { length: 255 }).notNull(),
spotifyId: varchar('spotify_id', { length: 32 }),
},
(table) => ({
nameEnIndex: index('artists__name_en__idx').on(table.nameEn),
}),
);
export const members = mysqlTable('members', {
id: serial('id').primaryKey(),
createdAt: timestamp('created_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
updatedAt: timestamp('updated_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
nameEn: varchar('name_en', { length: 50 }).notNull(),
nameKr: varchar('name_kr', { length: 50 }).notNull(),
stageNameEn: varchar('stage_name_en', { length: 50 }).notNull(),
stageNameKr: varchar('stage_name_kr', { length: 50 }).notNull(),
image: varchar('image', { length: 255 }).notNull(),
instagram: varchar('instagram', { length: 255 }).notNull(),
});
export const artistsToMembers = mysqlTable(
'artist_to_member',
{
id: serial('id').primaryKey(),
memberId: int('member_id').notNull(),
artistId: int('artist_id').notNull(),
},
(table) => ({
memberArtistIndex: index('artist_to_member__artist_id__member_id__idx').on(
table.memberId,
table.artistId,
),
}),
);
export const albums = mysqlTable(
'albums',
{
id: serial('id').primaryKey(),
createdAt: timestamp('created_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
updatedAt: timestamp('updated_at')
.notNull()
.default(sql`CURRENT_TIMESTAMP`),
artistId: int('artist_id').notNull(),
name: varchar('name', { length: 50 }).notNull(),
region: mysqlEnum('region', ['en', 'kr', 'jp', 'other']).notNull(),
releaseDate: date('release_date').notNull(),
image: varchar('image', { length: 255 }).notNull(),
spotifyId: varchar('spotify_id', { length: 32 }),
},
(table) => ({
artistIndex: index('albums__artist_id__idx').on(table.artistId),
nameIndex: index('albums__name__idx').on(table.name),
}),
);
// 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
- mysql-core
Imported By
Source
Frequently Asked Questions
What does mysql.duplicates.ts do?
mysql.duplicates.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, SQLDialects subdomain.
What functions are defined in mysql.duplicates.ts?
mysql.duplicates.ts defines 7 function(s): albumRelations, albums, artistRelations, artists, artistsToMembers, artistsToMembersRelations, memberRelations.
What does mysql.duplicates.ts depend on?
mysql.duplicates.ts imports 2 module(s): drizzle-orm, mysql-core.
What files import mysql.duplicates.ts?
mysql.duplicates.ts is imported by 1 file(s): mysql.duplicates.test.ts.
Where is mysql.duplicates.ts in the architecture?
mysql.duplicates.ts is located at integration-tests/tests/relational/issues-schemas/duplicates/mysql/mysql.duplicates.ts (domain: DrizzleORM, subdomain: SQLDialects, directory: integration-tests/tests/relational/issues-schemas/duplicates/mysql).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free