Luca (steebchen)
Luca (steebchen)
CDCloudflare Developers
Created by Walshy on 5/25/2024 in #d1-database
That seems like the current bookmark id
thanks!
7 replies
CDCloudflare Developers
Created by Walshy on 5/25/2024 in #d1-database
That seems like the current bookmark id
any idea?
7 replies
CDCloudflare Developers
Created by Walshy on 5/25/2024 in #d1-database
That seems like the current bookmark id
seems like it's still disabled even though the current id is different now
7 replies
CDCloudflare Developers
Created by Walshy on 5/25/2024 in #d1-database
That seems like the current bookmark id
No description
7 replies
DTDrizzle Team
Created by Luca (steebchen) on 5/4/2024 in #help
Invalid results when joining
Schema:
const updatedAt = text('updated_at', { mode: 'text' })
.notNull()
.default(sql`(current_timestamp)`)
.$onUpdate(() => new Date().toISOString())

const createdAt = numeric('created_at')
.default(sql`(current_timestamp)`)
.notNull()

export const products = sqliteTable('product', {
id: text('id').primaryKey().notNull(),
createdAt,
updatedAt,
views: integer('views').default(1).notNull(),
title: text('title').notNull(),
slug: text('slug').notNull().unique(),
description: text('description'),
})

export const websites = sqliteTable(
'website',
{
id: text('id').primaryKey().notNull(),
createdAt,
updatedAt,
url: text('url').notNull(),
productId: text('product_id')
.notNull()
.references(() => products.id, {
onDelete: 'cascade',
onUpdate: 'cascade',
}),
},
(t) => ({
productId: index('website__product_id_idx').on(t.productId),
}),
)

export const pages = sqliteTable(
'page',
{
id: text('id').primaryKey().notNull(),
createdAt,
updatedAt,
title: text('title'),
url: text('url').notNull(),
description: text('description'),
content: text('content'),
websiteId: text('website_id')
.notNull()
.references(() => websites.id, {
onDelete: 'cascade',
onUpdate: 'cascade',
}),
},
(t) => ({
uniqueUrls: index('pages__unique_urls').on(t.id, t.url),
websiteId: index('pages__website_id_idx').on(t.websiteId),
}),
)
const updatedAt = text('updated_at', { mode: 'text' })
.notNull()
.default(sql`(current_timestamp)`)
.$onUpdate(() => new Date().toISOString())

const createdAt = numeric('created_at')
.default(sql`(current_timestamp)`)
.notNull()

export const products = sqliteTable('product', {
id: text('id').primaryKey().notNull(),
createdAt,
updatedAt,
views: integer('views').default(1).notNull(),
title: text('title').notNull(),
slug: text('slug').notNull().unique(),
description: text('description'),
})

export const websites = sqliteTable(
'website',
{
id: text('id').primaryKey().notNull(),
createdAt,
updatedAt,
url: text('url').notNull(),
productId: text('product_id')
.notNull()
.references(() => products.id, {
onDelete: 'cascade',
onUpdate: 'cascade',
}),
},
(t) => ({
productId: index('website__product_id_idx').on(t.productId),
}),
)

export const pages = sqliteTable(
'page',
{
id: text('id').primaryKey().notNull(),
createdAt,
updatedAt,
title: text('title'),
url: text('url').notNull(),
description: text('description'),
content: text('content'),
websiteId: text('website_id')
.notNull()
.references(() => websites.id, {
onDelete: 'cascade',
onUpdate: 'cascade',
}),
},
(t) => ({
uniqueUrls: index('pages__unique_urls').on(t.id, t.url),
websiteId: index('pages__website_id_idx').on(t.websiteId),
}),
)
2 replies