78 lines
3.4 KiB
TypeScript
78 lines
3.4 KiB
TypeScript
import { integer, serial, text, pgTable, timestamp, jsonb, varchar, char, numeric, boolean, uuid, real, doublePrecision } from 'drizzle-orm/pg-core';
|
|
import { InferInsertModel, InferModel, InferModelFromColumns, InferSelectModel, relations, sql } from 'drizzle-orm';
|
|
|
|
export const PG_CONNECTION = 'PG_CONNECTION';
|
|
|
|
export const users = pgTable('users', {
|
|
id: uuid('id').primaryKey().defaultRandom(),
|
|
firstname: varchar('firstname', { length: 255 }).notNull(),
|
|
lastname: varchar('lastname', { length: 255 }).notNull(),
|
|
email: varchar('email', { length: 255 }).notNull(),
|
|
phoneNumber: varchar('phoneNumber', { length: 255 }),
|
|
description: text('description'),
|
|
companyName: varchar('companyName', { length: 255 }),
|
|
companyOverview: text('companyOverview'),
|
|
companyWebsite: varchar('companyWebsite', { length: 255 }),
|
|
companyLocation: varchar('companyLocation', { length: 255 }),
|
|
offeredServices: text('offeredServices'),
|
|
areasServed: varchar('areasServed', { length: 100 }).array(),
|
|
hasProfile: boolean('hasProfile'),
|
|
hasCompanyLogo: boolean('hasCompanyLogo'),
|
|
licensedIn:varchar('licensedIn', { length: 50 }).array(),
|
|
});
|
|
|
|
export const businesses = pgTable('businesses', {
|
|
id: uuid('id').primaryKey().defaultRandom(),
|
|
userId: uuid('userId').references(()=>users.id),
|
|
type: varchar('type', { length: 255 }),
|
|
title: varchar('title', { length: 255 }),
|
|
description: text('description'),
|
|
city: varchar('city', { length: 255 }),
|
|
state: char('state', { length: 2 }),
|
|
price: doublePrecision('price'),
|
|
favoritesForUser: varchar('favoritesForUser',{length:30}).array(),
|
|
draft: boolean('draft'),
|
|
listingsCategory: varchar('listingsCategory', { length: 255 }),
|
|
realEstateIncluded: boolean('realEstateIncluded'),
|
|
leasedLocation: boolean('leasedLocation'),
|
|
franchiseResale: boolean('franchiseResale'),
|
|
salesRevenue: doublePrecision('salesRevenue'),
|
|
cashFlow: doublePrecision('cashFlow'),
|
|
supportAndTraining: text('supportAndTraining'),
|
|
employees: integer('employees'),
|
|
established: integer('established'),
|
|
internalListingNumber: integer('internalListingNumber'),
|
|
reasonForSale: varchar('reasonForSale', { length: 255 }),
|
|
brokerLicencing: varchar('brokerLicencing', { length: 255 }),
|
|
internals: text('internals'),
|
|
created: timestamp('created'),
|
|
updated: timestamp('updated'),
|
|
visits: integer('visits'),
|
|
lastVisit: timestamp('lastVisit'),
|
|
});
|
|
export const commercials = pgTable('commercials', {
|
|
id: uuid('id').primaryKey().defaultRandom(),
|
|
userId: uuid('userId').references(()=>users.id),
|
|
type: varchar('type', { length: 255 }),
|
|
title: varchar('title', { length: 255 }),
|
|
description: text('description'),
|
|
city: varchar('city', { length: 255 }),
|
|
state: char('state', { length: 2 }),
|
|
price: doublePrecision('price'),
|
|
favoritesForUser: varchar('favoritesForUser',{length:30}).array(),
|
|
hideImage: boolean('hideImage'),
|
|
draft: boolean('draft'),
|
|
zipCode:integer('zipCode'),
|
|
county:varchar('county', { length: 255 }),
|
|
email: varchar('email', { length: 255 }),
|
|
website: varchar('website', { length: 255 }),
|
|
phoneNumber: varchar('phoneNumber', { length: 255 }),
|
|
imageOrder:varchar('imageOrder',{length:30}).array(),
|
|
imagePath:varchar('imagePath',{length:30}).array(),
|
|
created: timestamp('created'),
|
|
updated: timestamp('updated'),
|
|
visits: integer('visits'),
|
|
lastVisit: timestamp('lastVisit'),
|
|
});
|
|
|