dolibarr-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dolibarr-dev] creating .sql file


From: Doursenaud , Raphaël
Subject: Re: [Dolibarr-dev] creating .sql file
Date: Mon, 20 Jul 2015 10:02:27 +0200

Hi,

You may want to take a look at the module template I made a few years ago: https://github.com/gpcsolutions/dolibarr-module-template

You'll see that the sql data is under the /sql directory and the code that populates the database is in the module descriptor at /core/modules/modMyModule.class.php

Can you provide a link to the documentation you've been following? It's obviously not up-to-date.

Regards,

2015-07-20 9:24 GMT+02:00 Irfan Majeed <address@hidden>:
hi i am confused at this point on dolibarr documentation i am creating my own module for testing
"
Then in the "load_tables" function of your file descriptor module, modify the line (where is load_tables defined ?)
$dir = DOL_DOCUMENT_ROOT.'/mymodule/sql/';

by

$dir = DOL_DOCUMENT_ROOT.'/valuechooseformymodule/sql/';(what is valuechooseformymodule?)

Rules to follow:

  • Add the files about creating tables commands on the principle of a file llx_matable.sql per table with a possibly file llx_matable.key.sql (see existing files in install/mysql/tables for examples).
  • To manage data, you must create a file called data.sql inside directory /mymodule/sql/ that contains SQL command to add/edit/delete data.

Example of content of a file data.sql

 DELETE FROM llx_const WHERE name='MYMODULE_IT_WORKS' AND entity='__ENTITY__';
 INSERT INTO llx_const (name, value, type, note, visible, entity) VALUES ('MYMODULE_IT_WORKS','1','chaine','A constant vor my module',1,'__ENTITY__'


data.sql will be populated automatically when some operation happens on database ?



Thanks












"

_______________________________________________
Dolibarr-dev mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev




--
Raphaël Doursenaud
Directeur technique (CTO)
Expert certifié en déploiement Google Apps
+33 (0)5 35 53 97 13 - +33 (0)6 68 48 20 10

http://gpcsolutions.fr
Technopole Hélioparc
2 avenue du Président Pierre Angot
64053 PAU CEDEX 9
SARL GPC.solutions au capital de 7 500 € - R.C.S. PAU 528 995 921

reply via email to

[Prev in Thread] Current Thread [Next in Thread]