schema
All checks were successful
Vercel Production Deployment / Deploy-Production (push) Successful in 1m57s

This commit is contained in:
christian 2024-05-23 20:18:41 +02:00
parent b0fa899735
commit 8d606fd7b8
3 changed files with 18 additions and 16 deletions

View File

@ -1,10 +1,9 @@
import Link from "next/link";
export default function HomePage() {
return (
<main className="">
<div className="container ">
<h1>Yes hello</h1>
<p></p>
</div>
</main>
);

View File

@ -3,4 +3,5 @@ import { drizzle } from 'drizzle-orm/vercel-postgres';
import { sql } from '@vercel/postgres';
import * as schema from './schema';
export const db = drizzle(sql, { schema });
export const db = drizzle(sql, { schema });

View File

@ -1,12 +1,14 @@
// Example model schema from the Drizzle docs
// https://orm.drizzle.team/docs/sql-schema-declaration
import { sql } from "drizzle-orm";
import { drizzle } from 'drizzle-orm/vercel-postgres';
import { sql } from "@vercel/postgres";
import {
PgTimestamp,
index,
pgTableCreator,
serial,
text,
timestamp,
uniqueIndex,
uuid,
varchar,
} from "drizzle-orm/pg-core";
@ -21,14 +23,14 @@ export const createTable = pgTableCreator((name) => `wine-shop_${name}`);
export const posts = createTable(
"post",
{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
createdAt: timestamp("created_at", { withTimezone: true })
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
updatedAt: timestamp("updatedAt", { withTimezone: true }),
id: uuid('id').primaryKey(),
post: text('post').notNull(),
createdAt: timestamp('createdAt').defaultNow().notNull(),
updatedAt: timestamp('updatedAt').defaultNow()
},
(posts) => {
return {
uniqueIdx: uniqueIndex('unique_idx').on(posts.id),
};
},
(example) => ({
nameIndex: index("name_idx").on(example.name),
})
);