schema
All checks were successful
Vercel Production Deployment / Deploy-Production (push) Successful in 1m57s
All checks were successful
Vercel Production Deployment / Deploy-Production (push) Successful in 1m57s
This commit is contained in:
parent
b0fa899735
commit
8d606fd7b8
@ -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>
|
||||
);
|
||||
|
@ -4,3 +4,4 @@ import { sql } from '@vercel/postgres';
|
||||
import * as schema from './schema';
|
||||
|
||||
export const db = drizzle(sql, { schema });
|
||||
|
||||
|
@ -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),
|
||||
})
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user