View Source Glific.Seeds.SeedsMigration (Glific v5.1.6)

One shot migration of data to add simulators and saas admin. We use the functions in this file to add simulators for new organizations as they are created

Link to this section Summary

Functions

Add a saas user for the organization. We need to check if it already exists since this code is used during data migration and can be repeated for the same organization

Reset message number for a list of organizations or for a org_id

Reset message number for a list of organizations or for a contact id

Public interface to do a seed migration across all organizations.

Create default organization roles for an organization

sync all the hsm from BSP to Glific DB

Sync bigquery schema with local db changes.

Link to this section Functions

Link to this function

add_saas_user(organization, language)

View Source

Add a saas user for the organization. We need to check if it already exists since this code is used during data migration and can be repeated for the same organization

Link to this function

fix_message_number(org_id)

View Source
@spec fix_message_number(list() | integer()) :: :ok

Reset message number for a list of organizations or for a org_id

Link to this function

fix_message_number_for_contact(contact_id)

View Source
@spec fix_message_number_for_contact(integer()) :: :ok

Reset message number for a list of organizations or for a contact id

Link to this function

migrate_data(phase, organization \\ nil)

View Source
@spec migrate_data(atom(), Glific.Partners.Organization.t() | nil) :: :ok

Public interface to do a seed migration across all organizations.

One function to rule them all. This function is invoked manually by a glific developer to add data from the DB. This seems the cleanest way to do such things. We use phases to separate different migrations

Link to this function

set_default_organization_roles(org_id)

View Source
@spec set_default_organization_roles(non_neg_integer()) ::
  Glific.AccessControl.Role.t()

Create default organization roles for an organization

Link to this function

sync_hsm_templates(org_id_list)

View Source
@spec sync_hsm_templates(list()) :: :ok

sync all the hsm from BSP to Glific DB

Link to this function

sync_schema_with_bigquery(org_id_list)

View Source
@spec sync_schema_with_bigquery(list()) :: :ok

Sync bigquery schema with local db changes.