Version 6.x.x Source

Class DbColumn

__init__ (self, table, fieldname, fieldtype, length, default, set_index, options, unique, precision)

No docs


build_for_alter_table (self, current_def)

No docs


default_changed (self, current_def)

No docs


default_changed_for_decimal (self, current_def)

No docs


get_definition (self, with_default=1)

No docs



Class DbManager

Basically, a wrapper for oft-used mysql commands. like show tables,databases, variables etc...

TODO:

0.  Simplify / create settings for the restore database source folder
0a. Merge restore database and extract_sql(from frappe_server_tools).
1. Setter and getter for different mysql variables.
2. Setter and getter for mysql variables at global level??

__init__ (self, db)

Pass root_conn here for access to all databases.


create_database (self, target)

No docs


create_user (self, user, password, host)

No docs


delete_user (self, target, host)

No docs


drop_database (self, target)

No docs


drop_table (self, table_name)

drop table if exists


flush_privileges (self)

No docs


get_database_list (self)

get list of databases


get_table_schema (self, table)

Just returns the output of Desc tables.


get_tables_list (self, target=None)

get list of tables


get_variables (self, regex)

Get variables that match the passed pattern regex


grant_all_privileges (self, target, user, host)

No docs


grant_select_privilges (self, db, table, user, host)

No docs


restore_database (self, target, source, user, password)

No docs



Class DbTable

__init__ (self, doctype, prefix=tab)

No docs


alter (self)

No docs


create (self)

No docs


drop_foreign_keys (self)

No docs


get_column_definitions (self)

No docs


get_columns_from_db (self)

No docs


get_columns_from_docfields (self)

get columns from docfields and custom fields


get_foreign_keys (self)

No docs


get_index_definitions (self)

No docs


is_new (self)

No docs


sync (self)

No docs


validate (self)

Check if change in varchar length isn't truncating the columns



Class InvalidColumnName

Inherits from frappe.exceptions.ValidationError


frappe.model.db_schema.add_column (doctype, column_name, fieldtype, precision=None)

No docs


frappe.model.db_schema.get_definition (fieldtype, precision=None, length=None)

No docs


frappe.model.db_schema.remove_all_foreign_keys ()

No docs


frappe.model.db_schema.updatedb (dt)

Syncs a DocType to the table * creates if required * updates columns * updates indices


frappe.model.db_schema.validate_column_name (n)

No docs