Wrong generation postgresql

Something is def wrong here.
export const activitiesTable = pgTable(
"activites",
{
id: uuid("id").primaryKey().defaultRandom(),
user: varchar("id")
.references(() => users.id)
.notNull(),
clan: uuid("clan")
.references(() => clans.id)
.notNull(),
},
(t) => {
return {
unique: unique().on(t.user, t.clan),
idIdx: uniqueIndex("activiesid_idx").on(t.id),
userClanIdx: uniqueIndex("user_clan_idx").on(t.user, t.clan),
};
}
);

export const activitiesTableRelations = relations(
activitiesTable,
({ many }) => ({
activities: many(activities),
})
);

export const activities = pgTable(
"activitesTimestamps",
{
id: uuid("id").primaryKey().defaultRandom(),
table: uuid("id").references(() => activitiesTable.id),
start: timestamp("start").notNull(),
end: timestamp("end").notNull(),
duration: timestamp("duration").notNull(),
channel: varchar("channel"),
},
(t) => {
return {
idIdx: uniqueIndex("activiesTimestamps_idx").on(t.id),
tableIdx: index("table_idx").on(t.table),
};
}
);

export const activitiesRelations = relations(activities, ({ one }) => ({
id: one(activitiesTable, {
fields: [activities.table],
references: [activitiesTable.id],
}),
}));
export const activitiesTable = pgTable(
"activites",
{
id: uuid("id").primaryKey().defaultRandom(),
user: varchar("id")
.references(() => users.id)
.notNull(),
clan: uuid("clan")
.references(() => clans.id)
.notNull(),
},
(t) => {
return {
unique: unique().on(t.user, t.clan),
idIdx: uniqueIndex("activiesid_idx").on(t.id),
userClanIdx: uniqueIndex("user_clan_idx").on(t.user, t.clan),
};
}
);

export const activitiesTableRelations = relations(
activitiesTable,
({ many }) => ({
activities: many(activities),
})
);

export const activities = pgTable(
"activitesTimestamps",
{
id: uuid("id").primaryKey().defaultRandom(),
table: uuid("id").references(() => activitiesTable.id),
start: timestamp("start").notNull(),
end: timestamp("end").notNull(),
duration: timestamp("duration").notNull(),
channel: varchar("channel"),
},
(t) => {
return {
idIdx: uniqueIndex("activiesTimestamps_idx").on(t.id),
tableIdx: index("table_idx").on(t.table),
};
}
);

export const activitiesRelations = relations(activities, ({ one }) => ({
id: one(activitiesTable, {
fields: [activities.table],
references: [activitiesTable.id],
}),
}));
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server