Example #1
0
def apply_public_func_updates(apps, schema_editor):
    path = msh.find_db_functions_dir()
    for funcfile in (
            # trigger func is the same as original apply (interface not changed) but does not have the drop in the file.
            "partitioned_manager_trigger_function.sql", ):
        msh.apply_sql_file(schema_editor,
                           os.path.join(path, funcfile),
                           literal_placeholder=True)
Example #2
0
def apply_public_function_updates(apps, schema_editor):
    path = msh.find_db_functions_dir()
    for funcfile in (
            "partitioned_tables_manage_trigger_function.sql",
            "partitioned_tables_active_trigger_function.sql",
            "scan_date_partitions.sql",
    ):
        msh.apply_sql_file(schema_editor,
                           os.path.join(path, funcfile),
                           literal_placeholder=True)
Example #3
0
def apply_public_func_updates(apps, schema_editor):
    path = msh.find_db_functions_dir()
    for funcfile in (
            # trigger func is the same as original apply (interface not changed) but does not have the drop in the file.
            "reapply_partitioned_tables_manage_trigger_function.sql",
            # Drop/create here is not being used in triggers as of this migration.
            "clone_schema.sql",
    ):
        msh.apply_sql_file(schema_editor,
                           os.path.join(path, funcfile),
                           literal_placeholder=True)
Example #4
0
    def _check_clone_func(self):
        LOG.info(f'Verify that clone function "{self._CLONE_SCHEMA_FUNC_SIG}" exists')
        res = dbfunc_exists(
            conn, self._CLONE_SCHEMA_FUNC_SCHEMA, self._CLONE_SHEMA_FUNC_NAME, self._CLONE_SCHEMA_FUNC_SIG
        )
        if not res:
            LOG.warning(f'Clone function "{self._CLONE_SCHEMA_FUNC_SIG}" does not exist')
            LOG.info(f'Creating clone function "{self._CLONE_SCHEMA_FUNC_SIG}"')
            apply_sql_file(conn.schema_editor(), self._CLONE_SCHEMA_FUNC_FILENAME, literal_placeholder=True)
            res = dbfunc_exists(
                conn, self._CLONE_SCHEMA_FUNC_SCHEMA, self._CLONE_SHEMA_FUNC_NAME, self._CLONE_SCHEMA_FUNC_SIG
            )
        else:
            LOG.info("Clone function exists")

        return res
Example #5
0
def apply_public_function_updates(apps, schema_editor):
    path = msh.find_db_functions_dir()
    for funcfile in ("jsonb_sha256_text.sql", ):
        msh.apply_sql_file(schema_editor, os.path.join(path, funcfile))
Example #6
0
def apply_clone_schema(apps, schema_editor):
    path = msh.find_db_functions_dir()
    msh.apply_sql_file(schema_editor,
                       os.path.join(path, "clone_schema.sql"),
                       literal_placeholder=True)
Example #7
0
def apply_create_partition_procedure(apps, schema_editor):
    path = msh.find_db_functions_dir()
    for funcfile in ("create_table_date_range_partition.sql",
                     "create_date_partitions.sql"):
        msh.apply_sql_file(schema_editor, os.path.join(path, funcfile))
Example #8
0
def apply_presto_del_trigger_func(apps, schema_editor):
    path = msh.find_db_functions_dir()
    msh.apply_sql_file(schema_editor,
                       os.path.join(path, "presto_delete_trigger_func.sql"))