ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Teamโ€ข15mo agoโ€ข
7 replies
jsingleton37

Column of relation already exists

I have a couple of tables

export const schoolReferences = pgTable(
  'school_references',
  {
    id: serial('id').primaryKey(),
    sanityId: text('sanity_id').notNull().unique(),
    name: text('name'),
  },
  (table) => [uniqueIndex('sanity_id_idx').on(table.sanityId)],
)

export const players = pgTable('players', {
  id: serial('id').primaryKey(),
  firstName: text('first_name').notNull(),
  lastName: text('last_name').notNull(),
  currentSchoolId: integer('current_school_id').references(() => schoolReferences.id),
})

export const transferPortalEntries = pgTable('transfer_portal_entries', {
  id: serial('id').primaryKey(),
  playerId: integer('player_id')
    .references(() => players.id)
    .notNull(),
  previousSchoolId: integer('previous_school_id')
    .references(() => schoolReferences.id)
    .notNull(),
  commitmentSchoolId: integer('commitment_school_id').references(() => schoolReferences.id),
})
export const schoolReferences = pgTable(
  'school_references',
  {
    id: serial('id').primaryKey(),
    sanityId: text('sanity_id').notNull().unique(),
    name: text('name'),
  },
  (table) => [uniqueIndex('sanity_id_idx').on(table.sanityId)],
)

export const players = pgTable('players', {
  id: serial('id').primaryKey(),
  firstName: text('first_name').notNull(),
  lastName: text('last_name').notNull(),
  currentSchoolId: integer('current_school_id').references(() => schoolReferences.id),
})

export const transferPortalEntries = pgTable('transfer_portal_entries', {
  id: serial('id').primaryKey(),
  playerId: integer('player_id')
    .references(() => players.id)
    .notNull(),
  previousSchoolId: integer('previous_school_id')
    .references(() => schoolReferences.id)
    .notNull(),
  commitmentSchoolId: integer('commitment_school_id').references(() => schoolReferences.id),
})

I went to add a new column
name
name
to the
school_references
school_references
table & remove a column from
transfer_portal_entries
transfer_portal_entries
and ran
drizzle-kit generate
drizzle-kit generate
followed by
drizzle-kit migrate
drizzle-kit migrate
. However, when I run the
migrate
migrate
command I get
applying migrations...PostgresError: column "name" of relation "school_references" already exists
applying migrations...PostgresError: column "name" of relation "school_references" already exists
. I previously added
name
name
via the Supabase dashboard to test something and then removed it but it was back after running
generate
generate
and
migrate
migrate
the other day (which I want). I'm not sure why it's complaining now.
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

relation users already exists
Drizzle TeamDTDrizzle Team / help
7mo ago
error: relation "xxx" already exists
Drizzle TeamDTDrizzle Team / help
13mo ago
enum label already exists
Drizzle TeamDTDrizzle Team / help
2y ago
How to suppress 'relation "x" already exists, skipping' logs during migration?
Drizzle TeamDTDrizzle Team / help
3y ago