Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

192 строки
8.8 KiB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>db_schema — Database Schema Management Module &mdash; Documentation</title>
  7. <link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '',
  12. VERSION: '',
  13. COLLAPSE_MODINDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="_static/jquery.js"></script>
  19. <script type="text/javascript" src="_static/doctools.js"></script>
  20. <link rel="top" title="Documentation" href="index.html" />
  21. <link rel="up" title="Server Side Internals" href="server_side_internals.html" />
  22. <link rel="next" title="db — Database" href="db.html" />
  23. <link rel="prev" title="code — Code Execution Module" href="code.html" />
  24. </head>
  25. <body>
  26. <div style="background-color: #FFF; text-align: left; padding: 8px 0px"><img src="_static/banner300910.gif"></div>
  27. <div class="related">
  28. <h3>Navigation</h3>
  29. <ul>
  30. <li class="right" style="margin-right: 10px">
  31. <a href="genindex.html" title="General Index"
  32. accesskey="I">index</a></li>
  33. <li class="right" >
  34. <a href="modindex.html" title="Global Module Index"
  35. accesskey="M">modules</a> |</li>
  36. <li class="right" >
  37. <a href="db.html" title="db — Database"
  38. accesskey="N">next</a> |</li>
  39. <li class="right" >
  40. <a href="code.html" title="code — Code Execution Module"
  41. accesskey="P">previous</a> |</li>
  42. <li><a href="index.html">Documentation</a> &raquo;</li>
  43. <li><a href="server_side_api.html" >3. Server Side API</a> &raquo;</li>
  44. <li><a href="server_side_internals.html" accesskey="U">Server Side Internals</a> &raquo;</li>
  45. </ul>
  46. </div>
  47. <div class="sphinxsidebar">
  48. <div class="sphinxsidebarwrapper">
  49. <h3><a href="index.html">Table Of Contents</a></h3>
  50. <ul>
  51. <li><a class="reference external" href=""><tt class="docutils literal"><span class="pre">db_schema</span></tt> &#8212; Database Schema Management Module</a><ul>
  52. <li><a class="reference external" href="#standard-fields-of-a-record">Standard fields of a record</a></li>
  53. </ul>
  54. </li>
  55. </ul>
  56. <h4>Previous topic</h4>
  57. <p class="topless"><a href="code.html"
  58. title="previous chapter"><tt class="docutils literal docutils literal"><span class="pre">code</span></tt> &#8212; Code Execution Module</a></p>
  59. <h4>Next topic</h4>
  60. <p class="topless"><a href="db.html"
  61. title="next chapter"><tt class="docutils literal docutils literal"><span class="pre">db</span></tt> &#8212; Database</a></p>
  62. <h3>This Page</h3>
  63. <ul class="this-page-menu">
  64. <li><a href="_sources/db_schema.txt"
  65. rel="nofollow">Show Source</a></li>
  66. </ul>
  67. <div id="searchbox" style="display: none">
  68. <h3>Quick search</h3>
  69. <form class="search" action="search.html" method="get">
  70. <input type="text" name="q" size="18" />
  71. <input type="submit" value="Go" />
  72. <input type="hidden" name="check_keywords" value="yes" />
  73. <input type="hidden" name="area" value="default" />
  74. </form>
  75. <p class="searchtip" style="font-size: 90%">
  76. Enter search terms or a module, class or function name.
  77. </p>
  78. </div>
  79. <script type="text/javascript">$('#searchbox').show(0);</script>
  80. </div>
  81. </div>
  82. <div class="document">
  83. <div class="documentwrapper">
  84. <div class="bodywrapper">
  85. <div class="body">
  86. <div class="section" id="module-db_schema">
  87. <h1><tt class="xref docutils literal"><span class="pre">db_schema</span></tt> &#8212; Database Schema Management Module<a class="headerlink" href="#module-db_schema" title="Permalink to this headline">¶</a></h1>
  88. <p>Syncs a database table to the <cite>DocType</cite> (metadata)
  89. <em>Note</em> This module is only used internally</p>
  90. <dl class="method">
  91. <dt id="db_schema.updatedb">
  92. <tt class="descclassname">db_schema.</tt><tt class="descname">updatedb</tt><big>(</big><em>dt</em><big>)</big><a class="headerlink" href="#db_schema.updatedb" title="Permalink to this definition">¶</a></dt>
  93. <dd>Syncs a <cite>DocType</cite> to the table
  94. * creates if required
  95. * updates columns
  96. * updates indices</dd></dl>
  97. <dl class="method">
  98. <dt id="db_schema.getcoldef">
  99. <tt class="descclassname">db_schema.</tt><tt class="descname">getcoldef</tt><big>(</big><em>ftype</em>, <em>length=''</em><big>)</big><a class="headerlink" href="#db_schema.getcoldef" title="Permalink to this definition">¶</a></dt>
  100. <dd><p>converts the user defined field types (ftype) to database fieldtypes
  101. example: <cite>Data</cite> becomes <cite>varchar(180)</cite></p>
  102. <p>Default field lengths:</p>
  103. <ul class="simple">
  104. <li>180 - Data / Select / Link / Read Only / Password</li>
  105. <li>14,2 - Currency</li>
  106. <li>14,6 - Float</li>
  107. </ul>
  108. </dd></dl>
  109. <dl class="method">
  110. <dt id="db_schema.updatecolumns">
  111. <tt class="descclassname">db_schema.</tt><tt class="descname">updatecolumns</tt><big>(</big><em>doctype</em><big>)</big><a class="headerlink" href="#db_schema.updatecolumns" title="Permalink to this definition">¶</a></dt>
  112. <dd><p>Updates columns from the <cite>DocType</cite> to the table</p>
  113. <ul class="simple">
  114. <li>adds a column if new</li>
  115. <li>changes the name if oldfieldname != fieldname</li>
  116. <li>changes the type</li>
  117. </ul>
  118. </dd></dl>
  119. <dl class="method">
  120. <dt id="db_schema.updateindex">
  121. <tt class="descclassname">db_schema.</tt><tt class="descname">updateindex</tt><big>(</big><em>doctype</em><big>)</big><a class="headerlink" href="#db_schema.updateindex" title="Permalink to this definition">¶</a></dt>
  122. <dd>Adds / removes indices from the given doctype table</dd></dl>
  123. <dl class="method">
  124. <dt id="db_schema.update_engine">
  125. <tt class="descclassname">db_schema.</tt><tt class="descname">update_engine</tt><big>(</big><em>doctype=None</em>, <em>engine='InnoDB'</em><big>)</big><a class="headerlink" href="#db_schema.update_engine" title="Permalink to this definition">¶</a></dt>
  126. <dd>Not used: Updated the MySQL table engine</dd></dl>
  127. <dl class="method">
  128. <dt id="db_schema.create_table">
  129. <tt class="descclassname">db_schema.</tt><tt class="descname">create_table</tt><big>(</big><em>dt</em><big>)</big><a class="headerlink" href="#db_schema.create_table" title="Permalink to this definition">¶</a></dt>
  130. <dd>Creates a table for a new doctype</dd></dl>
  131. <div class="section" id="standard-fields-of-a-record">
  132. <h2>Standard fields of a record<a class="headerlink" href="#standard-fields-of-a-record" title="Permalink to this headline">¶</a></h2>
  133. <blockquote>
  134. <ul class="simple">
  135. <li><cite>name</cite>: ID / primary key</li>
  136. <li><cite>owner</cite>: creator of the record</li>
  137. <li><cite>creation</cite>: datetime of creation</li>
  138. <li><cite>modified</cite>: datetime of last modification</li>
  139. <li><cite>modified_by</cite> : last updating user</li>
  140. <li><cite>docstatus</cite> : Status 0 - Saved, 1 - Submitted, 2- Cancelled</li>
  141. <li><cite>parent</cite> : if child (table) record, this represents the parent record</li>
  142. <li><cite>parenttype</cite> : type of parent record (if any)</li>
  143. <li><cite>parentfield</cite> : table fieldname of parent record (if any)</li>
  144. <li><cite>idx</cite> : Index (sequence) of the child record</li>
  145. </ul>
  146. </blockquote>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. <div class="clearer"></div>
  153. </div>
  154. <div class="related">
  155. <h3>Navigation</h3>
  156. <ul>
  157. <li class="right" style="margin-right: 10px">
  158. <a href="genindex.html" title="General Index"
  159. >index</a></li>
  160. <li class="right" >
  161. <a href="modindex.html" title="Global Module Index"
  162. >modules</a> |</li>
  163. <li class="right" >
  164. <a href="db.html" title="db — Database"
  165. >next</a> |</li>
  166. <li class="right" >
  167. <a href="code.html" title="code — Code Execution Module"
  168. >previous</a> |</li>
  169. <li><a href="index.html">Documentation</a> &raquo;</li>
  170. <li><a href="server_side_api.html" >3. Server Side API</a> &raquo;</li>
  171. <li><a href="server_side_internals.html" >Server Side Internals</a> &raquo;</li>
  172. </ul>
  173. </div>
  174. <div class="footer">
  175. &copy; Copyright 2010, Rushabh Mehta.
  176. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
  177. </div>
  178. </body>
  179. </html>