Sistema multi empresa con mysql

Re: Sistema multi empresa con mysql

Postby anserkk » Thu Feb 25, 2021 11:14 am

I recommend using one single database for all the companies. You can add one additional column in the tables to identify/differentiate the company the data belongs to. In the long run, this approach will benefit you.

If you keep separate databases for each company, then on a later date if you need to prepare comparison reports then it is going to be cumbersome connecting with different databases. I am not saying that it is not possible to connect to different databases and prepare comparisons. If the count of the number of company's increase in the future this is going to make things much harder for you.

If you keep a separate database for each company, then any change in the structure of the table OR any change in the stored procedures needs to be updated on all the databases. The chances of making mistakes are high and as days go by maintenance becomes a nightmare.

If you go for one single database model then just keep a public variable in your PRG to identify the CompanyID while starting your application, then let each SQL query/update contain this CompanyID

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Sistema multi empresa con mysql

Postby joseluisysturiz » Thu Feb 25, 2021 4:11 pm

anserkk wrote:I recommend using one single database for all the companies. You can add one additional column in the tables to identify/differentiate the company the data belongs to. In the long run, this approach will benefit you.

If you keep separate databases for each company, then on a later date if you need to prepare comparison reports then it is going to be cumbersome connecting with different databases. I am not saying that it is not possible to connect to different databases and prepare comparisons. If the count of the number of company's increase in the future this is going to make things much harder for you.

If you keep a separate database for each company, then any change in the structure of the table OR any change in the stored procedures needs to be updated on all the databases. The chances of making mistakes are high and as days go by maintenance becomes a nightmare.

If you go for one single database model then just keep a public variable in your PRG to identify the CompanyID while starting your application, then let each SQL query/update contain this CompanyID

Regards

Anser


Saludos, el detalle de usar una sola BD es que ...

* voy a teber todos los datos en una sola tabla, eso aumentatria el tanaño de las misnas y el tiempo de respuesta

* tengo que modificar todas las tablas agregando el campo que identifique a que empresa pertenece

* no es bueno tener todos los huevos en una misma cesta (metáfora)

* tengo que modificar todas las consultas y reportes con WHERE para saber a queempresa pertenece

* cuando haga respaldo como debe ser por empresa debo modificar el sistema de respaldo para que solo seleccione los registros de la empresa que respaldo

* otros

Todo eso lo evito usando una BD por empresa, solo debo al seleccionar la empresa cambiar la conexión a esa BD y listo. .sin ningun cambio en códigos...

Se pueden tener varias conexiones simultáneas
Sin problemas y sería solo para los recortes de consolidación que serían pocos

es mi punto y análisis que hice..igual gracias por tu sugerencia...Saludos... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Previous

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Enrico Maria Giordano, Google [Bot] and 64 guests