Esempio n. 1
0
 def _auto_init(self):
     res = super(IrTranslation, self)._auto_init()
     # Add separate md5 index on src (no size limit on values, and good performance).
     tools.create_index(self._cr, 'ir_translation_src_md5', self._table, ['md5(src)'])
     tools.create_unique_index(self._cr, 'ir_translation_unique', self._table,
                               ['type', 'name', 'lang', 'res_id', 'md5(src)'])
     return res
Esempio n. 2
0
 def _auto_init(self):
     result = super(ResUsers, self)._auto_init()
     # Use unique index to implement unique constraint per website, even if website_id is null 
     # (not possible using a constraint)
     tools.create_unique_index(self._cr, 'res_users_login_key_unique_website_index',
         self._table, ['login', 'COALESCE(website_id,-1)'])
     return result
Esempio n. 3
0
 def _auto_init(self):
     res = super(IrTranslation, self)._auto_init()
     # Add separate md5 index on src (no size limit on values, and good performance).
     tools.create_index(self._cr, 'ir_translation_src_md5', self._table, ['md5(src)'])
     tools.create_unique_index(self._cr, 'ir_translation_unique', self._table,
                               ['type', 'name', 'lang', 'res_id', 'md5(src)'])
     return res
Esempio n. 4
0
 def _auto_init(self):
     res = super(SyncLink, self)._auto_init()
     tools.create_unique_index(
         self._cr,
         "sync_link_refs_uniq_index",
         self._table,
         ["relation", "system1", "system2", "ref1", "ref2"],
     )
     return res
Esempio n. 5
0
 def _auto_init(self):
     result = super(ResUsers, self)._auto_init()
     # Use unique index to implement unique constraint per website, even if website_id is null
     # (not possible using a constraint)
     tools.create_unique_index(self._cr,
                               'res_users_login_key_unique_website_index',
                               self._table,
                               ['login', 'COALESCE(website_id,-1)'])
     return result
Esempio n. 6
0
 def _auto_init(self):
     result = super(IrFilters, self)._auto_init()
     # Use unique index to implement unique constraint on the lowercase name (not possible using a constraint)
     tools.create_unique_index(
         self._cr, 'ir_filters_name_model_uid_unique_action_index',
         self._table, [
             'lower(name)', 'model_id', 'COALESCE(user_id,-1)',
             'COALESCE(action_id,-1)'
         ])
     return result
Esempio n. 7
0
 def _auto_init(self):
     res = super(PullRequests, self)._auto_init()
     tools.create_unique_index(self._cr,
                               'runbot_merge_unique_pr_per_target',
                               self._table,
                               ['number', 'target', 'repository'])
     self._cr.execute("CREATE INDEX IF NOT EXISTS runbot_merge_pr_head "
                      "ON runbot_merge_pull_requests "
                      "USING hash (head)")
     return res
 def _auto_init(self):
     result = super(CommissionRule, self)._auto_init()
     # Unique index to handle product_id, template_id, pricelist_id even if those are null (not possible using a constraint).
     tools.create_unique_index(
         self._cr, 'commission_rule_check_combination_unique_index',
         self._table, [
             'plan_id', 'category_id', 'COALESCE(product_id, -1)',
             'COALESCE(template_id, -1)', 'COALESCE(pricelist_id, -1)'
         ])
     return result
Esempio n. 9
0
    def _auto_init(self):
        res = super(IrTranslation, self)._auto_init()
        # Add separate md5 index on src (no size limit on values, and good performance).
        tools.create_index(self._cr, 'ir_translation_src_md5', self._table, ['md5(src)'])
        # Cover 'model_terms' type
        tools.create_unique_index(self._cr, 'ir_translation_unique', self._table,
                                  ['type', 'name', 'lang', 'res_id', 'md5(src)'])
        if not tools.index_exists(self._cr, 'ir_translation_code_unique'):
            self._cr.execute("CREATE UNIQUE INDEX ir_translation_code_unique ON ir_translation (type, lang, md5(src)) WHERE type = 'code'")
        if not tools.index_exists(self._cr, 'ir_translation_model_unique'):
            self._cr.execute("CREATE UNIQUE INDEX ir_translation_model_unique ON ir_translation (type, lang, name, res_id) WHERE type = 'model'")

        return res
Esempio n. 10
0
 def _auto_init(self):
     res = super(IrTranslation, self)._auto_init()
     # Add separate md5 index on src (no size limit on values, and good performance).
     tools.create_index(self._cr, 'ir_translation_src_md5', self._table, ['md5(src)'])
     # Cover 'model_terms' type
     tools.create_unique_index(self._cr, 'ir_translation_unique', self._table,
                               ['type', 'name', 'lang', 'res_id', 'md5(src)'])
     if not tools.index_exists(self._cr, 'ir_translation_code_unique'):
         self._cr.execute("CREATE UNIQUE INDEX ir_translation_code_unique ON ir_translation (type, lang, md5(src)) WHERE type = 'code'")
     if not tools.index_exists(self._cr, 'ir_translation_model_unique'):
         self._cr.execute("CREATE UNIQUE INDEX ir_translation_model_unique ON ir_translation (type, lang, name, res_id) WHERE type = 'model'")
     if not tools.index_exists(self._cr, 'ir_translation_selection_unique'):
         self._cr.execute("CREATE UNIQUE INDEX ir_translation_selection_unique ON ir_translation (type, lang, name, md5(src)) WHERE type IN ('selection', 'constraint', 'sql_constraint')")
     return res
Esempio n. 11
0
 def _auto_init(self):
     res = super(Partner, self)._auto_init()
     tools.create_unique_index(self._cr, 'runbot_merge_unique_gh_login',
                               self._table, ['github_login'])
     return res
Esempio n. 12
0
 def _auto_init(self):
     res = super(IrActionsActWindowView, self)._auto_init()
     tools.create_unique_index(self._cr, 'act_window_view_unique_mode_per_action',
                               self._table, ['act_window_id', 'view_mode'])
     return res
Esempio n. 13
0
 def init(self):
     # line values should be unique per "base" - useful for testing corner cases with unique lines
     tools.create_unique_index(self._cr, 'test_performance_line_uniq', self._table, ['base_id', 'value'])
Esempio n. 14
0
 def _auto_init(self):
     res = super()._auto_init()
     tools.create_unique_index(self._cr, 'runbot_merge_review_m2m', self._table, ['partner_id', 'repository_id'])
     return res
Esempio n. 15
0
 def _auto_init(self):
     res = super(IrActionsActWindowView, self)._auto_init()
     tools.create_unique_index(self._cr, 'act_window_view_unique_mode_per_action',
                               self._table, ['act_window_id', 'view_mode'])
     return res
Esempio n. 16
0
 def init(self):
     # line values should be unique per "base" - useful for testing corner cases with unique lines
     tools.create_unique_index(self._cr, 'test_performance_line_uniq', self._table, ['base_id', 'value'])
Esempio n. 17
0
 def _auto_init(self):
     res = super(Repository, self)._auto_init()
     tools.create_unique_index(self._cr, 'runbot_merge_unique_repo',
                               self._table, ['name'])
     return res
Esempio n. 18
0
 def _auto_init(self):
     res = super(Branch, self)._auto_init()
     tools.create_unique_index(self._cr,
                               'runbot_merge_unique_branch_per_repo',
                               self._table, ['name', 'project_id'])
     return res
Esempio n. 19
0
 def _auto_init(self):
     result = super(IrFilters, self)._auto_init()
     # Use unique index to implement unique constraint on the lowercase name (not possible using a constraint)
     tools.create_unique_index(self._cr, 'ir_filters_name_model_uid_unique_action_index',
         self._table, ['lower(name)', 'model_id', 'COALESCE(user_id,-1)', 'COALESCE(action_id,-1)'])
     return result