export const post_schema = pgTable(
'posts',
{
id: serial('id').primaryKey(),
slug: text('slug').notNull(),
heading: text('heading').notNull(),
subheading: text('subheading').notNull(),
image: text('image').notNull(),
caption: text('caption').notNull(),
author_id: integer('author_id'),
tags: text('tags').array().notNull(),
article_html: text('article_html').notNull(),
article_text: text('article_text').notNull(),
published: boolean('published').default(false).notNull(),
date_published: timestamp('date_published'),
updated_by: text('updated_by').notNull(),
created_at: timestamp('created_at').defaultNow().notNull(),
updated_at: timestamp('updated_at').$onUpdate(() => new Date())
},
(table) => [
index('posts_search_index').using(
'gin',
sql`to_tsvector('english', coalesce(${table.article_text}, ''))`
)
]
);
export const post_schema = pgTable(
'posts',
{
id: serial('id').primaryKey(),
slug: text('slug').notNull(),
heading: text('heading').notNull(),
subheading: text('subheading').notNull(),
image: text('image').notNull(),
caption: text('caption').notNull(),
author_id: integer('author_id'),
tags: text('tags').array().notNull(),
article_html: text('article_html').notNull(),
article_text: text('article_text').notNull(),
published: boolean('published').default(false).notNull(),
date_published: timestamp('date_published'),
updated_by: text('updated_by').notNull(),
created_at: timestamp('created_at').defaultNow().notNull(),
updated_at: timestamp('updated_at').$onUpdate(() => new Date())
},
(table) => [
index('posts_search_index').using(
'gin',
sql`to_tsvector('english', coalesce(${table.article_text}, ''))`
)
]
);