How to control version number on budget?

Asked

Viewed 71 times

1

I’m racking my brain here to get to a common denominator, I have a system in Delphi with Postgresql, this system has a budget session

I need to control the changes made in these budgets by placing version number, that is to each change requested by the customer the seller forwarding a new budget has to register in the system each change.

Example: Seller sent 10 items, customer asked to leave only 9

Thus the first budget would be: 1.00, but the second 1.01

I’m gonna need to control everything, everything, even a comma.

I was thinking of cloning the tables (6 tables) that are used in this budget and storing the records in them whenever there is a update, but I can see that it will be very difficult to maintain this mirroring.

I ask colleagues if they’ve ever needed something like this and if they can contribute ideas, I work alone so I came to you.

  • You can place the structure of your tables?

  • 1

    Will you need to go back to the "version" of the budget? Or would it be another Log?

  • I will have to make it available to the seller to view the old budget and if I need to send to the customer to do the confrontation, IE he will have the option to see and print the old budget, so I was thinking of cloning everything.

  • David you quoting a log gave me an idea here, I can make a table as change log and save the budgets sent to PDF clients in a folder on the server.

  • @Marcelo Did the answer solve what was in doubt? Do you need something better? Do you think it is possible to accept it now?

2 answers

1

It’s simple, consider each version as a different budget, having information that identifies which version it is. You know the latter is worth. It may even have some mechanism to freeze edits.

Of course, each time you change part of the previous to create the new.

It is possible to make some optimizations to gain space, but then it starts to complicate a little.

In some cases the solution of having one table with the drafts and another with the ending may be useful, but it complicates a little I do not know if it is advantageous. would have to copy to the draft table and remove the current one. It can be a little simpler if you consider everything draft and only when you freeze the budget does you copy it to the final table and then you can’t touch it. I don’t think it pays.

1


I believe that cloning the tables is not the best alternative. What you can do is make your main table (which I imagine it is orcamento) be recursive.

For this add a field id_orcamento_anterior, so you duplicate the records but not the tables.

When you want to get the latest budgets you can do something like:

SELECT * FROM orcamento a
WHERE NOT EXISTS (
    SELECT b.id_orcamento FROM orcamento b
    WHERE a.`id_orcamento` = b.`id_orcamento_anterior`
);

With the result of this query, you can also pick up the previous budgets by the created field.

  • I’m on a sharp curve here, if I use the same table this table will swell up to an hour, because every change generates a new budget

  • So in that case, you would be bound anyway to duplicate your tables.

  • That is, that is the detail... with a table parallel to the search for an older budget the user is prepared if it takes a little longer, swelling the main table would slow down the system as a whole

  • If your table is well indexed, I believe you will not have problems with performance.

  • Roberto,I use Delphi XE with Postgresql9.x, I do not know what happens, my tables are indexed blz, a select in Pgadmin goes fast, already in Delphi it takes, so I saw is a problem when I use MEMO fields, and I have to use this type of field because in the base many fields are type Text because I work a lot with long texts, I am leaving to study this problem better later because the priority is to Versionar these budgets

Browser other questions tagged

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