Replies: 1 comment
-
Found the example file. import 'dotenv/config';
import { drizzle } from 'drizzle-orm/postgres-js';
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';
import { user } from './schema';
const migrationConnection = postgres(process.env.DATABASE_URL!, { max: 1 });
const queryConnection = postgres(process.env.DATABASE_URL!);
const db = drizzle(queryConnection);
const main = async () => {
await migrate(drizzle(migrationConnection), { migrationsFolder: 'drizzle' });
await migrationConnection.end();
// await db.insert(user).values([{ name: 'alef' }, { name: 'bolk' }]);
console.log(await db.select().from(user));
process.exit(0);
};
main(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The docs say to migrate a scehma via...
To clarify, if we're copy and pasting... I assume running it every time the file is compiled(?) is okay or...?
Beta Was this translation helpful? Give feedback.
All reactions