This is an automated email from the ASF dual-hosted git repository.
bsalzano pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-site.git
The following commit(s) were added to refs/heads/main by this push:
new dae9d8b fix: added create schema to use database tutorial (#52)
dae9d8b is described below
commit dae9d8b7f66ce8ed17f4a4f98a9697f2e9cc2e21
Author: Francesco Timperi Tiberi <[email protected]>
AuthorDate: Sun Dec 1 21:23:22 2024 +0100
fix: added create schema to use database tutorial (#52)
---
content/en/docs/tutorial/use-database/_index.md | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/content/en/docs/tutorial/use-database/_index.md
b/content/en/docs/tutorial/use-database/_index.md
index 7d5abc7..a2b2175 100644
--- a/content/en/docs/tutorial/use-database/_index.md
+++ b/content/en/docs/tutorial/use-database/_index.md
@@ -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),
@@ -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);
@@ -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!'}]
```