Skip to content

Commit dae9d8b

Browse files
fix: added create schema to use database tutorial (#52)
1 parent 1814487 commit dae9d8b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • content/en/docs/tutorial/use-database

content/en/docs/tutorial/use-database/_index.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ const { Client } = require('pg')
2121
async function main(args) {
2222
const client = new Client({ connectionString: args.dbUri });
2323

24+
const createSchema = `CREATE SCHEMA IF NOT EXISTS demo;`
25+
2426
const createTable = `
25-
CREATE TABLE IF NOT EXISTS contacts (
27+
CREATE TABLE IF NOT EXISTS demo.contacts (
2628
id serial PRIMARY KEY,
2729
name varchar(50),
2830
email varchar(50),
@@ -137,7 +139,7 @@ async function main(args) {
137139

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

245247
```bash
246-
ops devel psql sql "SELECT * FROM CONTACTS"
248+
ops devel psql sql "SELECT * FROM demo.CONTACTS"
247249

248250
[{'id': 1, 'name': 'OpenServerless', 'email': 'info@nuvolaris.io', 'phone': '5551233210', 'message': 'This is awesome!'}]
249251
```

0 commit comments

Comments
 (0)