You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

62 lines
1.7 KiB

  1. :mod:`db_schema` --- Database Schema Management Module
  2. ======================================================
  3. .. module:: db_schema
  4. :synopsis: Database Schema Management Module
  5. Syncs a database table to the `DocType` (metadata)
  6. *Note* This module is only used internally
  7. .. method:: updatedb(dt)
  8. Syncs a `DocType` to the table
  9. * creates if required
  10. * updates columns
  11. * updates indices
  12. .. method:: getcoldef(ftype, length='')
  13. converts the user defined field types (ftype) to database fieldtypes
  14. example: `Data` becomes `varchar(180)`
  15. Default field lengths:
  16. * 180 - Data / Select / Link / Read Only / Password
  17. * 14,2 - Currency
  18. * 14,6 - Float
  19. .. method:: updatecolumns(doctype)
  20. Updates columns from the `DocType` to the table
  21. * adds a column if new
  22. * changes the name if oldfieldname != fieldname
  23. * changes the type
  24. .. method:: updateindex(doctype)
  25. Adds / removes indices from the given doctype table
  26. .. method:: update_engine(doctype=None, engine='InnoDB')
  27. Not used: Updated the MySQL table engine
  28. .. method:: create_table(dt)
  29. Creates a table for a new doctype
  30. Standard fields of a record
  31. ---------------------------
  32. * `name`: ID / primary key
  33. * `owner`: creator of the record
  34. * `creation`: datetime of creation
  35. * `modified`: datetime of last modification
  36. * `modified_by` : last updating user
  37. * `docstatus` : Status 0 - Saved, 1 - Submitted, 2- Cancelled
  38. * `parent` : if child (table) record, this represents the parent record
  39. * `parenttype` : type of parent record (if any)
  40. * `parentfield` : table fieldname of parent record (if any)
  41. * `idx` : Index (sequence) of the child record