import { connect, disconnect, query, transaction, migrate, seed } from "@useful/postgresql";
(async function() {
await connect();
const migrationResult = await migrate([
`CREATE TABLE users (
id BIGSERIAL PRIMARY KEY,
name character varying(255)
)`,
`CREATE TABLE roles (
id SERIAL PRIMARY KEY,
name character varying(255)
)`,
]);
const seedResult = await seed([
`INSERT INTO users(name) VALUES('Mr. Spock')`,
`INSERT INTO roles(name) VALUES('Chief Science Officer')`,
]);
const queryResult = await query({
text: "SELECT * FROM users",
values: [],
});
const results = await transaction([
{
text: "SELECT * FROM users",
values: [],
},
{
text: "SELECT * FROM roles",
values: [],
},
]);
await disconnect();
})();
-
Notifications
You must be signed in to change notification settings - Fork 0
usefulio/postgresql
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
wrapper around pg
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published