Compare commits

...

2 Commits

Author SHA1 Message Date
Daniel
adaeb6ab05 cosmetics 2021-03-23 20:48:17 +01:00
Daniel
6e88453dea cds.deploy++ 2021-03-23 20:00:37 +01:00
3 changed files with 22 additions and 2 deletions

View File

@@ -16,8 +16,9 @@
"cds": {
"requires": {
"db": {
"kind": "sql"
"kind": "sqlite",
"model": "*"
}
}
}
}
}

BIN
bookshop/sqlite.db Normal file

Binary file not shown.

19
bookshop/srv/server.js Normal file
View File

@@ -0,0 +1,19 @@
const cds = require ('@sap/cds')
cds.on('listening', async ()=>{ try { //> just to see the output at the end; will later on be in db service impl
console.log ('\nFilling database with initial data...')
const m = cds.model.minified() //> we likely should do that by default
const tx = cds.tx()
tx.run ([ //> this will be replaced by
DELETE.from ('sap.capire.bookshop.Authors'),
DELETE.from ('sap.capire.bookshop.Books'),
DELETE.from ('sap.capire.bookshop.Books.texts'),
DELETE.from ('sap.capire.bookshop.Genres'),
DELETE.from ('sap.common.Currencies'),
DELETE.from ('sap.common.Currencies.texts'),
])
await cds.deploy(m).to(tx,{ddl:false})
await tx.commit()
} catch(e) { console.error(e) }})
module.exports = cds.server