Remove scripts folder (#276)
This commit is contained in:
parent
43c7cbb21e
commit
7402fc55af
1 changed files with 0 additions and 34 deletions
|
|
@ -1,34 +0,0 @@
|
||||||
import { db } from '@vercel/postgres'
|
|
||||||
|
|
||||||
async function seedUsers(client) {
|
|
||||||
try {
|
|
||||||
await client.sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`
|
|
||||||
const createTable = await client.sql`
|
|
||||||
CREATE TABLE IF NOT EXISTS users (
|
|
||||||
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
|
|
||||||
email TEXT NOT NULL UNIQUE,
|
|
||||||
password TEXT NOT NULL,
|
|
||||||
salt TEXT NOT NULL
|
|
||||||
);
|
|
||||||
`
|
|
||||||
|
|
||||||
console.log(`Created "users" table`)
|
|
||||||
|
|
||||||
return {
|
|
||||||
createTable,
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error seeding users:', error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
const client = await db.connect()
|
|
||||||
await seedUsers(client)
|
|
||||||
await client.end()
|
|
||||||
}
|
|
||||||
|
|
||||||
main().catch(err => {
|
|
||||||
console.error('An error occurred while attempting to seed the database:', err)
|
|
||||||
})
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue