Answer the question
In order to leave comments, you need to log in
Can different entities of objects be combined in one table?
Hello.
I work at a construction company, one of the types of duties is the preparation of responses to incoming documentation.
I have to work constantly with Excel and Word and a lot of photos. Very inconvenient and labor intensive. I decided to write a database, a server and a browser application. Familiar with SQL queries and Nodejs.
The scheme of work is as follows:
Answer the question
In order to leave comments, you need to log in
>> Is a relational database suitable or is it worth looking towards NoSQL?
It is correct to store the primary data in the relational database, and write the changes that employees make (versioning) into a separate JSON entity and add them to a separate table. The fact is that business logic may require the ability to work with transactions, and in NoSQL they are supported only at the document level (ElasticSearch, Mongo). If during operation you need to roll back changes in several entities, then NoSQL will not provide you with this.
There is an option to cross NoSQL and relational databases - use JSON in MySQL. But here there will be another problem - checking the schema of the data being written. Non-trivial task for MySQL. In general, NoSQL is still damp today, and you need to work on it to use it in projects. In Mongo, the schema seems to be there, in ElasticSearch it’s generally tough on the schema (since you ask a question, you definitely haven’t come across it and I assure you that you will spend no less time studying the schema in Elastic than on the project itself)
Yesterday I just answered a similar question with versioning in MySQL: How to do versioning like on a wiki?
As for versioning, there is one more thing - how to protect entities from being overwritten by another user? Based solely on my subjective opinion, I make an incremented field (say, version) for each entity (a group of values that I take as an entity), the value of which I give when selecting from the database. When saving an entity, the client is required to provide this index. If the index has not changed, then the write is allowed. As soon as the entity is written, I increment this field, and if another person also tries to overwrite the data with the old value of the version field, the program will not allow him to do this (this is a very primitive blocking method, very vaguely reminiscent of git. Hashes are used there, well, I simplified everything to disgrace) Checking the value of the version field is done in the trigger, it also cancels the write process if the versions do not match (which just cannot be done in pure NoSQL). It would be possible to do a read lock as in 1C, but for programs not at the 1c level, we have a bunch of hemorrhoids during implementation.
As for Excel and Word, read the description of the OOXML format and see the libraries for working with office formats. For Node I don't know, but for Java and C# there are very powerful ones if you don't want to deal with OOXML.
The rest of the entities in terms of business logic you described normally. Personally, in the production, I would ask a few questions to the direct executors of this bureaucratic procedure, but everything seems to be normal.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question