Closed son2005 closed 7 months ago
Hi @son2005,
I have tried to re-produce the issue with the bookshop. On my side, everything works:
cds build --profile pg
:❯ cds build --profile pg
building project [/Users/patricebender/SAPDevelop/dev/cap/samples/bookshop], clean [true]
cds-dk [7.8.0], cds [7.7.1], compiler [4.3.2], home [/Users/patricebender/SAPDevelop/dev/cap/samples/node_modules/@sap/cds]
{
build: {
target: 'gen',
tasks: [
{ for: 'nodejs', src: 'srv', options: { model: ['db', 'srv', 'app'] }},
{ for: 'postgres', src: 'db', options: { model: ['db', 'srv', 'app'] }}
]
}
}
done > wrote output to:
gen/pg/db/csn.json
gen/pg/db/data
gen/pg/package.json
gen/srv/index.js
gen/srv/package.json
gen/srv/srv/_i18n/i18n.json
gen/srv/srv/admin-service.js
gen/srv/srv/cat-service.js
gen/srv/srv/csn.json
gen/srv/srv/odata/v4/AdminService.xml
gen/srv/srv/odata/v4/CatalogService.xml
gen/srv/srv/odata/v4/UserService.xml
gen/srv/srv/user-service.js
build completed in 239 ms
cds deploy --profile pg
❯ cds deploy --profile pg
> init from db/init.js
> init from db/data/sap.capire.bookshop-Genres.csv
> init from db/data/sap.capire.bookshop-Books.texts.csv
> init from db/data/sap.capire.bookshop-Books.csv
> init from db/data/sap.capire.bookshop-Authors.csv
/> successfully deployed to localhost:5432
Books
cds build --profile pg
DEBUG=sql cds deploy --profile pg
(enabled env variable DEBUG=sql
for more verbose outputthis workflow also succeeds if no field has been changed (step 3.
and 4.
could be skipped)
❯ cds --version
@cap-js/cds-types: 0.3.0
@cap-js/postgres: 1.6.0
@cap-js/sqlite: 1.5.1
@capire/bookshop: 1.0.0
@sap/cds: 7.7.1
@sap/cds-compiler: 4.3.2
@sap/cds-dk: 7.8.0
@sap/cds-dk (global): 7.8.0
@sap/cds-fiori: 1.2.3
@sap/cds-foss: 5.0.0
@sap/cds-mtxs: 1.16.0
@sap/eslint-plugin-cds: 2.6.8
Node.js: v18.18.2
home: /Users/patricebender/SAPDevelop/dev/cap/samples/node_modules/@sap/cds
could you please add a sample repository with detailed steps to reproduce the issue? I suspect in the data a primary key is duplicated as indicated by the error message in your log 'duplicate key value violates unique constraint "TestService_test_pkey"'
Thanks!
closing this due to inactivity.
If the issue persists, feel free to get back to us with a reproducible sample. Thanks.
Description of erroneous behaviour
Hello, I've identified a bug with the cds deploy command. In step 4 of Automatic Schema Evolution, the command instructs to 'Fill in initial data from provided .csv files using UPSERT commands.' However, upon running cds deploy for the second time, it utilizes INSERT commands instead of UPSERT commands. Link to Automatic Schema Evolution
Details about your project