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: Florian HENRY
Subject: Re: [Dolibarr-dev] creating .sql file
Date: Mon, 20 Jul 2015 10:07:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Hello,

    All sql file into DOL_DOCUMENT_ROOT.'/mymodule/sql/'; are play in order
    First llx_table.sql
    second llx_table.key.sql
    third update.sql
    last data.sql

    Is is coded into _init method on core/class/DolibarrModule.class.php

Cdt.
Florian Henry
+33 6 03 76 48 07
address@hidden
http://www.open-concept.pro
Twitter : @_Open_Concept_
Google+ : https://www.google.com/+Open-conceptPro
Le 20/07/2015 09:24, Irfan Majeed a écrit :
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


reply via email to

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