#1 2015-11-20 10:30:35

markus_ja
Member
Registered: 2015-11-20
Posts: 10

Best practice when database schema will change in future

Hello,

I actually just want to share my database data (firebird) over the internet using REST and JSON (Client: Android using Android Studio).
Using mORMot seems to make that task pretty easy. But I wonder, what happens when my tables are going to change in the future, and old clients want to access "altered" tables, which will change in future versions of the server?

E.g.:
Current table name on server: TABLE_V1 => the corresponding REST uri for the client would be: http://myserver.com/root/table_v1
Altered table name on server in the future: TABLE_V2 => The server is then listening on: http://myserver.com/root/table_v2
(Subsquently, the table name stays the same, but new columns are added or column names are changed)

So my question is:
How to prepare my server to be ready for such changes in the future? E.g. redirecting OLD client request from http://myserver.com/root/table_v1 to ../table_v2 and still returning old JSON format records (data)?

Thanks,
markus

Offline

#2 2015-11-20 12:18:22

DigDiver
Member
Registered: 2013-04-29
Posts: 137

Re: Best practice when database schema will change in future

In my opinion, it is better to use the service method and API version.
Current version: http://myserver.com/V1/method_name

After schema is changed use new end point URL:
http://myserver.com/V2/method_name

So old clients will use V1, new user V2.

Offline

#3 2015-11-20 12:37:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: Best practice when database schema will change in future

+1 for the service-oriented solution.

Offline

#4 2015-11-20 13:58:49

markus_ja
Member
Registered: 2015-11-20
Posts: 10

Re: Best practice when database schema will change in future

Do you mean, instead of using TSQLRecord and publishing that table, I shall implenent my own published method on a derived TSQlRestServerFullMemory like in the example: 06 - Remote JSON REST Service?
How to I implement the GET/PUT/POST/DELETE commants sent by the client, do perform ny own DB access?

I am very new to the whole concept of SOA and REST and mORMot and providing data to clients. Therefore, it's bit hard for me where I shall start.

Last edited by markus_ja (2015-11-20 14:05:21)

Offline

#5 2015-11-20 14:00:39

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: Best practice when database schema will change in future

Offline

Board footer

Powered by FluxBB