src/dirbs/schema_migrators/v84_upgrade.py
def _migrate_barred_tac_list(self, logger, conn):
        """Method to migrate barred tac list."""
        with conn.cursor() as cursor:
            cursor.execute(sql.SQL("""CREATE TABLE historic_barred_tac_list (
                                          tac character varying(8) NOT NULL,
                                          start_date TIMESTAMP NOT NULL,
                                          end_date TIMESTAMP DEFAULT NULL
                                          );
                                          CREATE UNIQUE INDEX
                                                     ON historic_barred_tac_list
                                                  USING btree (tac)
                                                  WHERE (end_date IS NULL)"""))
            logger.debug('Created historic_barred_tac_list with indexing.')

            # Creating view to historic table
            cursor.execute("""CREATE VIEW barred_tac_list AS
                                   SELECT tac
                                     FROM historic_barred_tac_list
                                    WHERE end_date IS NULL WITH CHECK OPTION""")
            logger.debug('Created view on historic_barred_tac_list')

            # Granting permissions
            cursor.execute("""GRANT SELECT ON barred_tac_list
                                      TO dirbs_core_classify, dirbs_core_api, dirbs_core_import_barred_tac_list""")
            cursor.execute('GRANT CREATE ON SCHEMA core TO dirbs_core_import_barred_tac_list')
            logger.debug('Granted permissions on barred_tac_list')
Method to migrate barred tac list.
Method to migrate barred tac list.
Method to migrate barred tac list .
def _migrate_barred_tac_list(self, logger, conn):
        with conn.cursor() as cursor:
            cursor.execute(sql.SQL("""CREATE TABLE historic_barred_tac_list (
                                          tac character varying(8) NOT NULL,
                                          start_date TIMESTAMP NOT NULL,
                                          end_date TIMESTAMP DEFAULT NULL
                                          );
                                          CREATE UNIQUE INDEX
                                                     ON historic_barred_tac_list
                                                  USING btree (tac)
                                                  WHERE (end_date IS NULL)"""))
            logger.debug('Created historic_barred_tac_list with indexing.')
            cursor.execute("""CREATE VIEW barred_tac_list AS
                                   SELECT tac
                                     FROM historic_barred_tac_list
                                    WHERE end_date IS NULL WITH CHECK OPTION""")
            logger.debug('Created view on historic_barred_tac_list')
            cursor.execute("""GRANT SELECT ON barred_tac_list
                                      TO dirbs_core_classify, dirbs_core_api, dirbs_core_import_barred_tac_list""")
            cursor.execute('GRANT CREATE ON SCHEMA core TO dirbs_core_import_barred_tac_list')
            logger.debug('Granted permissions on barred_tac_list')
def _migrate_barred_tac_list ( self , logger , conn ) : with conn . cursor ( ) as cursor : cursor . execute ( sql . SQL ( """CREATE TABLE historic_barred_tac_list (
                                          tac character varying(8) NOT NULL,
                                          start_date TIMESTAMP NOT NULL,
                                          end_date TIMESTAMP DEFAULT NULL
                                          );
                                          CREATE UNIQUE INDEX
                                                     ON historic_barred_tac_list
                                                  USING btree (tac)
                                                  WHERE (end_date IS NULL)""" ) ) logger . debug ( 'Created historic_barred_tac_list with indexing.' ) cursor . execute ( """CREATE VIEW barred_tac_list AS
                                   SELECT tac
                                     FROM historic_barred_tac_list
                                    WHERE end_date IS NULL WITH CHECK OPTION""" ) logger . debug ( 'Created view on historic_barred_tac_list' ) cursor . execute ( """GRANT SELECT ON barred_tac_list
                                      TO dirbs_core_classify, dirbs_core_api, dirbs_core_import_barred_tac_list""" ) cursor . execute ( 'GRANT CREATE ON SCHEMA core TO dirbs_core_import_barred_tac_list' ) logger . debug ( 'Granted permissions on barred_tac_list' )
Method to migrate barred tac list.
Method to migrate barred tac list .
"""Method to migrate barred tac list.""" # Creating view to historic table # Granting permissions
self
logger
conn