array de galeria
This commit is contained in:
@@ -13,6 +13,7 @@ export const products = t.pgTable(
|
|||||||
stock: t.integer('stock').notNull().default(0),
|
stock: t.integer('stock').notNull().default(0),
|
||||||
address: t.text('address').notNull(),
|
address: t.text('address').notNull(),
|
||||||
urlImg: t.text('url_img').notNull(),
|
urlImg: t.text('url_img').notNull(),
|
||||||
|
gallery: t.text('gallery').array().notNull().default(sql`'{}'::text[]`),
|
||||||
status: t.text('status').notNull().default('BORRADOR'),
|
status: t.text('status').notNull().default('BORRADOR'),
|
||||||
userId: t.integer('user_id').references(() => users.id, { onDelete: 'cascade' }).notNull(),
|
userId: t.integer('user_id').references(() => users.id, { onDelete: 'cascade' }).notNull(),
|
||||||
...timestamps,
|
...timestamps,
|
||||||
@@ -26,6 +27,7 @@ export const viewProductsStore = t.pgView('v_product_store', {
|
|||||||
price: t.numeric('price'),
|
price: t.numeric('price'),
|
||||||
stock: t.integer('stock'),
|
stock: t.integer('stock'),
|
||||||
urlImg: t.text('url_img'),
|
urlImg: t.text('url_img'),
|
||||||
|
gallery: t.text('gallery'),
|
||||||
address: t.text('address'),
|
address: t.text('address'),
|
||||||
status: t.text('status'),
|
status: t.text('status'),
|
||||||
userId: t.integer('user_id'),
|
userId: t.integer('user_id'),
|
||||||
@@ -33,6 +35,6 @@ export const viewProductsStore = t.pgView('v_product_store', {
|
|||||||
email: t.text('email'),
|
email: t.text('email'),
|
||||||
phone: t.text('phone')
|
phone: t.text('phone')
|
||||||
}).as(sql`
|
}).as(sql`
|
||||||
select p.id as product_id, p.title, p.description, p.price, p.stock, p.url_img, p.address, p.status, p.user_id, u.fullname, u.email, u.phone
|
select p.id as product_id, p.title, p.description, p.price, p.stock, p.url_img, p.gallery, p.address, p.status, p.user_id, u.fullname, u.email, u.phone
|
||||||
from products p
|
from products p
|
||||||
left join auth.users as u on u.id = p.user_id`);
|
left join auth.users as u on u.id = p.user_id`);
|
||||||
Reference in New Issue
Block a user