Umstellung postgres 2. part
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
import { jsonb, varchar } from 'drizzle-orm/pg-core';
|
||||
import { pgTable, text, primaryKey } from 'drizzle-orm/pg-core';
|
||||
|
||||
export const businesses_json = pgTable('businesses_json', {
|
||||
id: varchar('id', { length: 255 }).primaryKey(),
|
||||
data: jsonb('data'),
|
||||
});
|
||||
|
||||
export type BusinessesJson = {
|
||||
id: string;
|
||||
data: Record<string, any>;
|
||||
};
|
||||
@@ -2,7 +2,7 @@ import { Module } from '@nestjs/common';
|
||||
import { drizzle } from 'drizzle-orm/node-postgres';
|
||||
import pkg from 'pg';
|
||||
const { Pool } = pkg;
|
||||
import * as schema from './businesses_json.model.js';
|
||||
import * as schema from './schema.js';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { jsonb, varchar } from 'drizzle-orm/pg-core';
|
||||
import { PG_CONNECTION } from './schema.js';
|
||||
|
||||
@@ -1,14 +1,32 @@
|
||||
import { integer, serial, text, pgTable } from 'drizzle-orm/pg-core';
|
||||
import { relations } from 'drizzle-orm';
|
||||
import { jsonb, varchar } from 'drizzle-orm/pg-core';
|
||||
import { integer, serial, text, pgTable, timestamp, jsonb, varchar } from 'drizzle-orm/pg-core';
|
||||
import { relations, sql } from 'drizzle-orm';
|
||||
|
||||
export const PG_CONNECTION = 'PG_CONNECTION';
|
||||
|
||||
export const businesses_json = pgTable('businesses_json', {
|
||||
id: varchar('id', { length: 255 }).primaryKey(),
|
||||
export const businesses_json = pgTable('businesses', {
|
||||
id: varchar('id', { length: 255 }).primaryKey().default(sql`uuid_generate_v4()`),
|
||||
data: jsonb('data'),
|
||||
created: timestamp('created'),
|
||||
updated: timestamp('updated'),
|
||||
visits: integer('visits'),
|
||||
last_visit: timestamp('last_visit'),
|
||||
});
|
||||
export const commercials_json = pgTable('commercials', {
|
||||
id: varchar('id', { length: 255 }).primaryKey().default(sql`uuid_generate_v4()`),
|
||||
data: jsonb('data'),
|
||||
created: timestamp('created'),
|
||||
updated: timestamp('updated'),
|
||||
visits: integer('visits'),
|
||||
last_visit: timestamp('last_visit'),
|
||||
});
|
||||
export const users = pgTable('users', {
|
||||
id: varchar('id', { length: 255 }).primaryKey().default(sql`uuid_generate_v4()`),
|
||||
data: jsonb('data'),
|
||||
created: timestamp('created'),
|
||||
updated: timestamp('updated'),
|
||||
visits: integer('visits'),
|
||||
last_visit: timestamp('last_visit'),
|
||||
});
|
||||
|
||||
export type BusinessesJson = {
|
||||
id: string;
|
||||
data: Record<string, any>;
|
||||
|
||||
Reference in New Issue
Block a user