def get_sync_sql(self, field_name, missing_langs, model):
        """
        Returns SQL needed for sync schema for a new translatable field.
        """
        qn = connection.ops.quote_name
        style = no_style()
        sql_output = []
        db_table = model._meta.db_table
        for lang in missing_langs:
            new_field = build_localized_fieldname(field_name, lang)
            f = model._meta.get_field(new_field)
            col_type = f.db_type(connection=connection)
            field_sql = [style.SQL_FIELD(qn(f.column)), style.SQL_COLTYPE(col_type)]
            # column creation
            stmt = "ALTER TABLE %s ADD COLUMN %s" % (qn(db_table), ' '.join(field_sql))
            if not f.null:
                stmt += " " + style.SQL_KEYWORD('NOT NULL')
            sql_output.append(stmt + ";")
        return sql_output
def get_sync_sql ( self , field_name , missing_langs , model ) : qn = connection . ops . quote_name style = no_style ( ) sql_output = [ ] db_table = model . _meta . db_table for lang in missing_langs : new_field = build_localized_fieldname ( field_name , lang ) f = model . _meta . get_field ( new_field ) col_type = f . db_type ( connection = connection ) field_sql = [ style . SQL_FIELD ( qn ( f . column ) ) , style . SQL_COLTYPE ( col_type ) ] stmt = "ALTER TABLE %s ADD COLUMN %s" % ( qn ( db_table ) , ' ' . join ( field_sql ) ) if not f . null : stmt += " " + style . SQL_KEYWORD ( 'NOT NULL' ) sql_output . append ( stmt + ";" ) return sql_output
Returns SQL needed for sync schema for a new translatable field.