drizzle setup
This commit is contained in:
10
src/db.ts
Normal file
10
src/db.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import "dotenv/config";
|
||||
import { drizzle } from "drizzle-orm/node-postgres";
|
||||
|
||||
// You can specify any property from the node-postgres connection options
|
||||
const db = drizzle({
|
||||
connection: {
|
||||
connectionString: process.env.DATABASE_URL!,
|
||||
ssl: true,
|
||||
},
|
||||
});
|
||||
7
src/db/schema.ts
Normal file
7
src/db/schema.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { integer, pgTable, varchar } from "drizzle-orm/pg-core";
|
||||
|
||||
export const usersTable = pgTable("users", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity(),
|
||||
name: varchar({ length: 255 }).notNull(),
|
||||
email: varchar({ length: 255 }).notNull().unique(),
|
||||
});
|
||||
Reference in New Issue
Block a user