stiba
stiba
Explore posts from servers
DTDrizzle Team
Created by stiba on 6/26/2024 in #help
Migrations complain about missing relations
Here are my schema definitions:
import { relations } from "drizzle-orm";
import {
integer,
json,
pgEnum,
pgTable,
serial,
text,
timestamp,
uniqueIndex,
varchar,
} from "drizzle-orm/pg-core";

export const users = pgTable(
"users",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
email: varchar("email", { length: 256 }).notNull(),
avatarUrl: text("avatar_url"),
},
(users) => {
return {
emailIndex: uniqueIndex("email_idx").on(users.email),
};
},
);

export const accountTypeEnum = pgEnum("account_type", ["discord"]);

export const accounts = pgTable("accounts", {
id: text("account_id").primaryKey(),
type: accountTypeEnum("account_type").notNull(),
accessToken: text("access_token").notNull(),
refreshToken: text("refresh_token").notNull(),
userId: integer("user_id")
.references(() => users.id)
.notNull(),
});

export const session = pgTable("session", {
id: text("id").primaryKey(),
data: json("data").notNull(),
expiresAt: timestamp("expires_at").notNull(),
});

export const userRelations = relations(users, ({ many }) => ({
accounts: many(accounts),
}));

export const accountsRelations = relations(accounts, ({ one }) => ({
user: one(users, {
fields: [accounts.userId],
references: [users.id],
}),
}));
import { relations } from "drizzle-orm";
import {
integer,
json,
pgEnum,
pgTable,
serial,
text,
timestamp,
uniqueIndex,
varchar,
} from "drizzle-orm/pg-core";

export const users = pgTable(
"users",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
email: varchar("email", { length: 256 }).notNull(),
avatarUrl: text("avatar_url"),
},
(users) => {
return {
emailIndex: uniqueIndex("email_idx").on(users.email),
};
},
);

export const accountTypeEnum = pgEnum("account_type", ["discord"]);

export const accounts = pgTable("accounts", {
id: text("account_id").primaryKey(),
type: accountTypeEnum("account_type").notNull(),
accessToken: text("access_token").notNull(),
refreshToken: text("refresh_token").notNull(),
userId: integer("user_id")
.references(() => users.id)
.notNull(),
});

export const session = pgTable("session", {
id: text("id").primaryKey(),
data: json("data").notNull(),
expiresAt: timestamp("expires_at").notNull(),
});

export const userRelations = relations(users, ({ many }) => ({
accounts: many(accounts),
}));

export const accountsRelations = relations(accounts, ({ one }) => ({
user: one(users, {
fields: [accounts.userId],
references: [users.id],
}),
}));
2 replies
SSolidJS
Created by Samual 🦢 on 1/17/2024 in #support
how do you get a route to respond with an http header?
Can you describe your usecase?
6 replies
SSolidJS
Created by Samual 🦢 on 1/17/2024 in #support
how do you get a route to respond with an http header?
An API-route?
6 replies
SSolidJS
Created by stiba on 11/27/2023 in #support
Infinite scrolling solid-start
I tried that but it gave me some weird error, I might've done something wrong. I moved it to an API route instead since it felt more correct.
4 replies
SSolidJS
Created by . on 10/14/2023 in #support
Is it a good idea to make a real time chat app with SolidStart + ASP.NET?
SignalR should be very simple to get setup with, no matter which framework you use.
5 replies
SSolidJS
Created by zimo on 10/9/2023 in #support
Use :before and :after inline?
I don't think there's support for it on style tags. Is the issue here that you don't want to import a separate css file?
2 replies
SSolidJS
Created by stiba on 10/8/2023 in #support
Route not updating its routeData
My routeData function was wrong. Changing from:
export function routeData() {
const params = useParams<{ matchId: string }>();

const [data] = createResource(
async () => {
const matchStatsResponse = await api.fetchMatch(params.matchId);
return matchStatsResponse;
}
);

return { data };
}
export function routeData() {
const params = useParams<{ matchId: string }>();

const [data] = createResource(
async () => {
const matchStatsResponse = await api.fetchMatch(params.matchId);
return matchStatsResponse;
}
);

return { data };
}
to:
export function routeData() {
const params = useParams<{ matchId: string }>();

const [data] = createResource(
() => params.matchId,
async (matchId: string) => {
const matchStatsResponse = await api.fetchMatch(matchId);
return matchStatsResponse;
}
);

return { data };
}
export function routeData() {
const params = useParams<{ matchId: string }>();

const [data] = createResource(
() => params.matchId,
async (matchId: string) => {
const matchStatsResponse = await api.fetchMatch(matchId);
return matchStatsResponse;
}
);

return { data };
}
fixes the issue and everything works as expected.
2 replies
DTDrizzle Team
Created by stiba on 3/18/2023 in #help
Applying migrations with drizzle-orm/pg-core
Perfect, thanks! I was just looking at the generic docs, not the ones for PG.
4 replies
CC#
Created by Denis on 3/11/2023 in #help
✅ Storing JSON and User data in a multi-tenant application
What about Marten? It's a document database built on top Postgres. https://martendb.io/
26 replies
SSolidJS
Created by stiba on 3/5/2023 in #support
solid-js reactivity eslint with functions
Are there any codesandbox templates or similar with the plugin configured?
6 replies
SSolidJS
Created by Bersaelor on 3/5/2023 in #support
`crossOrigin` and `playsInline` types don't work with solid & typescript
<video>
playsinline
A Boolean attribute indicating that the video is to be played "inline", that is within the element's playback area. Note that the absence of this attribute does not imply that the video will always be played in fullscreen.
9 replies
SSolidJS
Created by Bersaelor on 3/5/2023 in #support
`crossOrigin` and `playsInline` types don't work with solid & typescript
9 replies
SSolidJS
Created by Bersaelor on 3/5/2023 in #support
`crossOrigin` and `playsInline` types don't work with solid & typescript
Aha. playsinline isn't actually a valid attribute on an audio element. It's only for videos.
9 replies
SSolidJS
Created by Bersaelor on 3/5/2023 in #support
`crossOrigin` and `playsInline` types don't work with solid & typescript
What does your tsconfig.json look like?
9 replies
SSolidJS
Created by Bersaelor on 3/5/2023 in #support
`crossOrigin` and `playsInline` types don't work with solid & typescript
it's not camelcased in solidjs. try
<audio playsinline />
<link crossorigin="anonymous" />
<audio playsinline />
<link crossorigin="anonymous" />
Edit: Looks like both crossOrigin and crossorigin is supported on link with solidjs, but it's not a boolean so you'll have to pass it either anonymous or use-credentials
9 replies
SSolidJS
Created by stiba on 3/5/2023 in #support
solid-js reactivity eslint with functions
This still doesn't solve my problem though when I have a function that I'm passing down the tree. It takes 2 arguments, and in one of the children I create a new function that passes the first argument, and then the child only needs to supply one argument
6 replies
SSolidJS
Created by stiba on 3/5/2023 in #support
solid-js reactivity eslint with functions
Okay so I see that you're supposed to do something along these lines
<MyComponent
onStatusChanged={[props.onTaskStatusChanged, status]}
/>
<MyComponent
onStatusChanged={[props.onTaskStatusChanged, status]}
/>
6 replies
SSolidJS
Created by stiba on 3/5/2023 in #support
routeData not being refreshed when navigating
Thanks 🙂
6 replies
SSolidJS
Created by stiba on 3/5/2023 in #support
routeData not being refreshed when navigating
Perfect, that solved it!
6 replies
SSolidJS
Created by stiba on 3/5/2023 in #support
routeData not being refreshed when navigating
Ah, I'm reading the docs but there's only mention of keys, not any example of how to use it (at least not in the part of the docs where I'm reading)
6 replies