src/dirbs/schema_migrators/v84_upgrade.py
def _migrate_subscriber_registration_list(self, logger, conn):
        """Method to migrate/create subscriber registration list table."""
        with conn.cursor() as cursor:
            # create subscriber registration
            cursor.execute(sql.SQL("""CREATE TABLE historic_subscribers_registration_list (
                                          uid CHARACTER VARYING(20) NOT NULL,
                                          imsi TEXT NOT NULL,
                                          start_date TIMESTAMP NOT NULL,
                                          end_date TIMESTAMP DEFAULT NULL
                                          );
                                          CREATE UNIQUE INDEX
                                                ON historic_subscribers_registration_list
                                             USING btree (uid, imsi)
                                             WHERE (end_date IS NULL)"""))
            logger.debug('Created historic_subscriber_registration_list table')

            # creating view to historic table
            cursor.execute(sql.SQL("""CREATE VIEW subscribers_registration_list AS
                                           SELECT uid, imsi
                                             FROM historic_subscribers_registration_list
                                            WHERE end_date IS NULL WITH CHECK OPTION"""))  # noqa: Q440
            logger.debug('Created view on historic_subscriber_registration_list')

            # granting permissions
            cursor.execute("""GRANT SELECT ON subscribers_registration_list
                                      TO dirbs_core_classify, dirbs_core_import_subscribers_registration_list""")

            logger.debug('Granting create permission to dirbs_core_import_subscriber_registration_list...')
            cursor.execute('GRANT CREATE ON SCHEMA core TO dirbs_core_import_subscribers_registration_list')
Method to migrate/create subscriber registration list table.
Method to migrate/create subscriber registration list table.
Method to migrate / create subscriber registration list table .
def _migrate_subscriber_registration_list(self, logger, conn):
        with conn.cursor() as cursor:
            cursor.execute(sql.SQL("""CREATE TABLE historic_subscribers_registration_list (
                                          uid CHARACTER VARYING(20) NOT NULL,
                                          imsi TEXT NOT NULL,
                                          start_date TIMESTAMP NOT NULL,
                                          end_date TIMESTAMP DEFAULT NULL
                                          );
                                          CREATE UNIQUE INDEX
                                                ON historic_subscribers_registration_list
                                             USING btree (uid, imsi)
                                             WHERE (end_date IS NULL)"""))
            logger.debug('Created historic_subscriber_registration_list table')
            cursor.execute(sql.SQL("""CREATE VIEW subscribers_registration_list AS
                                           SELECT uid, imsi
                                             FROM historic_subscribers_registration_list
                                            WHERE end_date IS NULL WITH CHECK OPTION"""))  
            logger.debug('Created view on historic_subscriber_registration_list')
            cursor.execute("""GRANT SELECT ON subscribers_registration_list
                                      TO dirbs_core_classify, dirbs_core_import_subscribers_registration_list""")
            logger.debug('Granting create permission to dirbs_core_import_subscriber_registration_list...')
            cursor.execute('GRANT CREATE ON SCHEMA core TO dirbs_core_import_subscribers_registration_list')
def _migrate_subscriber_registration_list ( self , logger , conn ) : with conn . cursor ( ) as cursor : cursor . execute ( sql . SQL ( """CREATE TABLE historic_subscribers_registration_list (
                                          uid CHARACTER VARYING(20) NOT NULL,
                                          imsi TEXT NOT NULL,
                                          start_date TIMESTAMP NOT NULL,
                                          end_date TIMESTAMP DEFAULT NULL
                                          );
                                          CREATE UNIQUE INDEX
                                                ON historic_subscribers_registration_list
                                             USING btree (uid, imsi)
                                             WHERE (end_date IS NULL)""" ) ) logger . debug ( 'Created historic_subscriber_registration_list table' ) cursor . execute ( sql . SQL ( """CREATE VIEW subscribers_registration_list AS
                                           SELECT uid, imsi
                                             FROM historic_subscribers_registration_list
                                            WHERE end_date IS NULL WITH CHECK OPTION""" ) ) logger . debug ( 'Created view on historic_subscriber_registration_list' ) cursor . execute ( """GRANT SELECT ON subscribers_registration_list
                                      TO dirbs_core_classify, dirbs_core_import_subscribers_registration_list""" ) logger . debug ( 'Granting create permission to dirbs_core_import_subscriber_registration_list...' ) cursor . execute ( 'GRANT CREATE ON SCHEMA core TO dirbs_core_import_subscribers_registration_list' )
Method to migrate/create subscriber registration list table.
Method to migrate / create subscriber registration list table .
"""Method to migrate/create subscriber registration list table.""" # create subscriber registration # creating view to historic table # noqa: Q440 # granting permissions
self
logger
conn