hexcowboy
hexcowboy
Explore posts from servers
RRailway
Created by hexcowboy on 1/30/2024 in #✋|help
railway seems to have a missed a recent github push to my branch
and the interface will only allow me to redeploy the previous commit. how do i deploy the latest commit?
8 replies
DTDrizzle Team
Created by hexcowboy on 1/24/2024 in #help
not getting proper type inference on any queries
i'm trying to get jobs with companies using drizzle queries
const job = await db.query.jobs.findFirst({
where: eq(jobs.id, id),
with: {
company: true,
},
});

const title = `${job.title} at ${job.company.name}`;
const job = await db.query.jobs.findFirst({
where: eq(jobs.id, id),
with: {
company: true,
},
});

const title = `${job.title} at ${job.company.name}`;
but for some reason the type of jobs does not have the company property: Property 'company' does not exist on type '...' i have made sure to define the relation in my schema file
export const jobs = pgTable("jobs", {
id: uuid("id").notNull().primaryKey().defaultRandom(),
companyId: uuid("company_id")
.references(() => companies.id, { onDelete: "cascade" })
.notNull(),
/* ... */
});

export const jobCompanyRelation = relations(jobs, ({ one }) => ({
company: one(companies, {
fields: [jobs.companyId],
references: [companies.id],
}),
}));
export const jobs = pgTable("jobs", {
id: uuid("id").notNull().primaryKey().defaultRandom(),
companyId: uuid("company_id")
.references(() => companies.id, { onDelete: "cascade" })
.notNull(),
/* ... */
});

export const jobCompanyRelation = relations(jobs, ({ one }) => ({
company: one(companies, {
fields: [jobs.companyId],
references: [companies.id],
}),
}));
using drizzle-orm 0.29.3
2 replies
DTDrizzle Team
Created by hexcowboy on 1/16/2024 in #help
multiple joins of same table in one query?
i want to do this query
return await db
.select({
...getTableColumns(interests),
user: getTableColumns(users),
referral: getTableColumns(referrals),
referrer: getTableColumns(users),
})
.from(interests)
.innerJoin(users, eq(interests.userId, users.id))
.leftJoin(referrals, eq(interests.referralId, referrals.id))
.leftJoin(users, eq(referrals.referrer, users.id));
return await db
.select({
...getTableColumns(interests),
user: getTableColumns(users),
referral: getTableColumns(referrals),
referrer: getTableColumns(users),
})
.from(interests)
.innerJoin(users, eq(interests.userId, users.id))
.leftJoin(referrals, eq(interests.referralId, referrals.id))
.leftJoin(users, eq(referrals.referrer, users.id));
basically i have one inner join on users and also a left join on users. but the resulting type makes all fields never when i remove either of the joins on users, i get the correct types
3 replies
RRailway
Created by hexcowboy on 6/22/2023 in #✋|help
Unable to connect to Postgres database
I'm not able to connect to my postgres database suddenly. Even on the web app it appears I can't make a connection.
10 replies
RRailway
Created by hexcowboy on 6/12/2023 in #✋|help
Railway.app not resolving
7 replies
RRailway
Created by hexcowboy on 4/10/2023 in #✋|help
I haven't been able to connect to any Postgres database all day
I've been creating and destroying instances of Postgres to try to get my connection to work. I've tried connecting to it via psql cli, railway cli, and TablePlus. All the connections time out.
6 replies
RRailway
Created by hexcowboy on 3/27/2023 in #✋|help
build is not updating
i'm trying to debug an issue in my app on railway. i decided to add a console log to see what the issue was, but every time i rebuild the console log does not show up. i also tried another commit with a console log earlier and it doesn't show up in my deployment logs. i believe my build is not actually pulling the latest commit
6 replies
RRailway
Created by hexcowboy on 3/1/2023 in #✋|help
Expose environment variables on build
I'm building my Rust project on Railway using a custom Dockerfile. My build requires DATABASE_URL to be set during the build stage since it checks queries at compile-time. How do I expose my environment variables when my app is building?
7 replies
RRailway
Created by hexcowboy on 2/16/2023 in #✋|help
(Rust) Cargo Workspace app failing to build with "value from workspace hasn't been set"
My app is a Cargo workspace with three separate apps. My build command is cargo build --release --bin server which works fine when I clone the repo locally and run from the workspace root. When I try to deploy on railway, the build vaguely fails with the message:
==============
Using Nixpacks
==============
context: 873b5b7db18a8b314d40e3e9ec94409f
Nixpacks build failed

Error: value from workspace hasn't been set
==============
Using Nixpacks
==============
context: 873b5b7db18a8b314d40e3e9ec94409f
Nixpacks build failed

Error: value from workspace hasn't been set
9 replies