Database maintenance c#

Asked

Viewed 103 times

4

I have a system in another language and I need to create an update for this system, but it needs to be run Mysql Scripts for database maintenance.

I searched in Java and found Maven that has all this maintenance control and reads the scripts written in SQL. In c# the closest I could get was the code First Migrations, but I did not find any example where it ran SQL Scripts.

My big question is whether I can do this with Migrations, if not, there’s another way to do it in C#?

  • you talk about making a system and the start of it make changes like adding new fields or deleting existing fields ? if it is, yes Code First does it .

  • 1

    The idea of code first is not to maintain a script-based database but to maintain a data model (classes).

1 answer

1

I’ll give you how to do in a system, which does not work with any Framwork ORM:

In the client database, I have a key:

last_upd_sql

which stores the code of the last database update that was received.

On the server, I have a table:

id|descricao|script|data|etc...

where I insert each script that must be executed in the client base.

A WebService, received as parameter, the id of the last update the client received, and returns a XML with all commands after this id.

The client system consumes this WebService sending the value of last_upd_sql then processes each command received by XML updating the value of last_upd_sql.

This system has been working for a few years and I’ve never had a problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.