Skip to content

Commit

Permalink
fix: added create schema to use database tutorial (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
francescotimperi authored Dec 1, 2024
1 parent 1814487 commit dae9d8b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions content/en/docs/tutorial/use-database/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ const { Client } = require('pg')
async function main(args) {
const client = new Client({ connectionString: args.dbUri });

const createSchema = `CREATE SCHEMA IF NOT EXISTS demo;`

const createTable = `
CREATE TABLE IF NOT EXISTS contacts (
CREATE TABLE IF NOT EXISTS demo.contacts (
id serial PRIMARY KEY,
name varchar(50),
email varchar(50),
Expand Down Expand Up @@ -137,7 +139,7 @@ async function main(args) {

try {
let res = await client.query(
'INSERT INTO contacts(name,email,phone,message) VALUES($1,$2,$3,$4)',
'INSERT INTO demo.contacts(name,email,phone,message) VALUES($1,$2,$3,$4)',
[name, email, phone, message]
);
console.log(res);
Expand Down Expand Up @@ -243,7 +245,7 @@ with the integrated services, such as the database we are using.
For instance, let’s run:

```bash
ops devel psql sql "SELECT * FROM CONTACTS"
ops devel psql sql "SELECT * FROM demo.CONTACTS"

[{'id': 1, 'name': 'OpenServerless', 'email': '[email protected]', 'phone': '5551233210', 'message': 'This is awesome!'}]
```
Expand Down

0 comments on commit dae9d8b

Please sign in to comment.