cancel
Showing results for 
Search instead for 
Did you mean: 

Update Tenants database schema with Migration Tables (.hdbmigrationtable)

robert_Wang
Discoverer
0 Kudos
152

We want to use .hdbmigrationtable to change the schema of our tenants database.

Attempting 1:

"journal": 

{

  "enable-drop": true,  

  "change-mode": "alter"

}

run "mbt build" -> get .mtar file

run "CF deploy " -> deploy to provider account

in saas registry service we click update, the tenants database is successfully updated.

BUT: in this case since we enabled drop to "true", we will lose Control over the .hdbmigrationtable files from manipulating the possible data lose risks. And that feature is what we are glad to have.

So after mbt build or cds build, we want to manipulate .hdbmigrationtable file and deploy the result directly to the cloud.

Attempting 2:

if we change this to:

"journal": {  

  "enable-drop": false,

  "change-mode": "alter"

}

once we run update in saas registry service, it will run cds build again during the process(found from log), which will generate ">>>>> Manual resolution required - DROP statements causing data loss are ..." and this will lead an error to exit.

So in .cdsrc.json, we remove the task "for hana":

"build": {

  "tasks": [

  {
    "for": "java-cf",
  }
// {

// "for": "hana"// 

// }
]
},

afterwards we run update in saas registry service again, it will lead to an info message in log:

No "db" directory set - skipping deployment

Attempting 3:

In that case we tried another way to deploy them directly to the database via cds deploy,

but we failed to specify the service name

 cds deploy --to hana:<service name><br>

and we have no idea what to do.

----------------------------------------------------

above is what we have tried, and my question is:

how can we build cds files locally and manipulate the .hdbmigrationtable files and then directly deploy them into tenant database?

Any advices and suggestions are much appreciated!!!!.

gregorw
Active Contributor
0 Kudos

Please improve the formatting.

Accepted Solutions (0)

Answers (0)